CEA-COSMIC / pysap-mri

MRI external plugin for Python Sparse data Analysis Package
Other
43 stars 18 forks source link

[BUG] [URGENT] Parallel WaveletN has issues when n_jobs!=1 #104

Closed chaithyagr closed 4 years ago

chaithyagr commented 4 years ago

For Calibratinless reconstruction, we would have to carry out wavelet transform across all the channels. In order to speed things up, I set up the codes for running linear_op in parallel. However, this caused the following issue:

In the definition of WaveletN, we define just one linear operator:

https://github.com/CEA-COSMIC/pysap-mri/blob/db04fe2956adaf0b1e84bc58dc99e5f63664286e/mri/operators/linear/wavelet.py#L61-L62

Then we use this in parallel to obtain our images in _op() function:

https://github.com/CEA-COSMIC/pysap-mri/blob/db04fe2956adaf0b1e84bc58dc99e5f63664286e/mri/operators/linear/wavelet.py#L71-L77

In doing so, we are eventually using the same wavelet operator for all the channels in parallel which causes severe races. Due to this the overall image is bad and has artifacts like phase wrapping in magnitude image.

I will get a PR fixing this, but for now, users are requested to not use n_jobs Also, this seems like a hole in testing, hence adding a testing tag and I will add a test for the same.

Thanks to @Daval-G in helping in identifying this major issue...