[PIPE2D-862] Make pipeline compatible with MKL libraries Created: 23/Jun/21 Updated: 29/Jan/22 Resolved: 30/Jun/21 |
|
| Status: | Done |
| Project: | DRP 2-D Pipeline |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Normal |
| Reporter: | ncaplar | Assignee: | price |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Reviewers: | hassan |
| Description |
|
The 2d psf generating code is considerable slower when running under LSST imports, when compared to when being run with same libraries outside LSST environment. Testing reveals that to generate a 20x20 images in focus, same code under LSST env takes around 1.3 seconds, and around 0.85 seconds outside LSST enviroment. Profliing is in support of my suspicion and previous result that the main slowdown is due to slower FFT calculations. Profiling results are attached as ``LSST_package'' and ``my_package''. They are complex to read, but careful comparison shows that that FFT calculations take larger fraction of time under LSST enviroment. This is almost certainly due to the fact that LSST env does not support MKL. During Monday meeting, it has benn clarified that this is due to legacy support which is not needed any more, and it should be relatively easy and painfree to turn MKL support back on. |
| Comments |
| Comment by rhl [ 23/Jun/21 ] |
|
price when you get back next week, what would it take to provide a version of numpy with MKL if we ignore the sincPhotometry problems? I bet we could fix that if needs be, but I don't expect to need to run that algorithm in PFS. |
| Comment by price [ 29/Jun/21 ] |
|
ncaplar, could you please provide a test script that I can run that will time the operations you're interested in? Then I can run that script with and without the changes I'm thinking of to see if they are effective. |
| Comment by ncaplar [ 29/Jun/21 ] |
|
Yes, of course. Give me a bit of time. |
| Comment by ncaplar [ 29/Jun/21 ] |
|
I have placed the smallest script at /tigress/ncaplar/Images/ |
| Comment by price [ 30/Jun/21 ] |
|
Activating MKL in a Docker container on my MacBook resulted in about a 2x speedup for the FFT operation:
ncalls tottime percall cumtime percall filename:lineno(function)
10 0.000 0.000 2.217 0.222 /opt/pfs/python/miniconda3-4.5.12/envs/lsst-scipipe-1172c30/lib/python3.7/site-packages/scipy/fftpack/basic.py:370(fft2)
vs:
10 0.000 0.000 5.029 0.503 /opt/pfs/python/miniconda3-4.5.12/envs/lsst-scipipe-1172c30/lib/python3.7/site-packages/scipy/fftpack/basic.py:673(fft2)
I'll update our install scripts and do a bit more testing to be sure this doesn't break anything else. |
| Comment by price [ 30/Jun/21 ] |
|
Integration test passed, I think we can deploy this. |
| Comment by ncaplar [ 30/Jun/21 ] |
|
Did you also perhaps test the execution times with the test code I have provided? |
| Comment by hassan [ 30/Jun/21 ] |
|
Changes made approved. But check comment from Neven above. |
| Comment by price [ 30/Jun/21 ] |
|
Yes, same result as before. |
| Comment by ncaplar [ 30/Jun/21 ] |
|
I meant regarding the timing, did you also get a speed up making it comparable to non-LSST code? (I can see that for myself once when deployed) |
| Comment by price [ 30/Jun/21 ] |
|
Yes, I got the same timing results as before. |
| Comment by ncaplar [ 30/Jun/21 ] |
|
Hm, so no speed up when using MKL libraries within LSST code with test.py? Am I understanding this correctly? |
| Comment by price [ 30/Jun/21 ] |
|
| Comment by ncaplar [ 30/Jun/21 ] |
|
Ok, I understand. I thought that ``same result as before'' was to be interpreted as ``same result as before the changes'', and I was super confused. |
| Comment by price [ 30/Jun/21 ] |
(lsst-scipipe) pprice@tiger2-sumire:/tigress/ncaplar/Images/PIPE2D-862 $ time python test.py
test ended
Time spent in user mode : 0.582 sec
Time spent in kernel mode : 0.235 sec
Total time : 0.820 sec
CPU utilisation : 99.60%
|
| Comment by price [ 30/Jun/21 ] |
|
Merged and deployed. |