Repository: gadgetron/gadgetron (language: python)

Issue:
Gadgetron environment.yml has incompatible packages stored
**Describe the bug**
conda ```environment.yml``` has incompatible packages, caused failure of environment creation both in Ubuntu and DevContainer.

**To Reproduce**
run ```conda env create -f environment.yml```

**Logs/Screenshots**
![image](https://user-images.githubusercontent.com/65115609/206867313-b32f8562-0ed0-45cd-b42f-e5a2f3a3424e.png)

**System Information:**
 - OS: Ubuntu20.04 in Windows11 WSL2 (also DevContainer in gadgetron)



Discussion / hints:

Fix patch:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 26613dad2..c606cd67a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,7 +52,7 @@ endif ()
 #VERSIONING AND INSTALL PATHS
 set(GADGETRON_VERSION_MAJOR 4)
 set(GADGETRON_VERSION_MINOR 4)
-set(GADGETRON_VERSION_PATCH 2)
+set(GADGETRON_VERSION_PATCH 3)
 set(GADGETRON_VERSION_STRING ${GADGETRON_VERSION_MAJOR}.${GADGETRON_VERSION_MINOR}.${GADGETRON_VERSION_PATCH})
 set(GADGETRON_SOVERSION ${GADGETRON_VERSION_MAJOR}.${GADGETRON_VERSION_MINOR})
 find_package(Git)
diff --git a/Dockerfile b/Dockerfile
index 152641c2e..fe1b8ac58 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -24,7 +24,7 @@ RUN groupadd --gid $USER_GID $USERNAME \
     && chmod 0440 /etc/sudoers.d/$USERNAME
 
 # The version of conda to use
-ARG CONDA_VERSION=4.11.0
+ARG CONDA_VERSION=22.11.1
 
 # Based on https://github.com/ContinuumIO/docker-images/blob/master/miniconda3/debian/Dockerfile.
 # We also install conda-lock.
@@ -66,14 +66,18 @@ RUN chmod +x /tini
 
 FROM gadgetron_baseimage AS gadgetron_dev_cuda
 ARG USER_UID
+ARG HOME
 USER ${USER_UID}
+RUN mkdir -p ${HOME}/.cache/conda/notices && sudo chown -R ${USER_UID}:conda ${HOME}/.cache/conda/notices
 RUN grep -v "#.*\<NOFILTER\>" /tmp/build/environment.yml > /tmp/build/filtered_environment.yml
 RUN umask 0002 && /opt/conda/bin/conda env create -f /tmp/build/filtered_environment.yml && /opt/conda/bin/conda clean -afy && sudo chown -R :conda /opt/conda
 USER root
 
 FROM gadgetron_baseimage AS gadgetron_dev_nocuda
 ARG USER_UID
+ARG HOME
 USER ${USER_UID}
+RUN mkdir -p ${HOME}/.cache/conda/notices && sudo chown -R ${USER_UID}:conda ${HOME}/.cache/conda/notices
 RUN grep -v "#.*\<cuda\>" /tmp/build/environment.yml > /tmp/build/filtered_environment.yml
 RUN umask 0002 && /opt/conda/bin/conda env create -f /tmp/build/filtered_environment.yml && /opt/conda/bin/conda clean -afy && sudo chown -R :conda /opt/conda
 USER root
@@ -110,7 +114,9 @@ RUN . /opt/conda/etc/profile.d/conda.sh && umask 0002 && conda activate gadgetro
 
 FROM gadgetron_baseimage AS gadgetron_rt_cuda
 ARG USER_UID
+ARG HOME
 USER ${USER_UID}
+RUN mkdir -p ${HOME}/.cache/conda/notices && sudo chown -R ${USER_UID}:conda ${HOME}/.cache/conda/notices
 RUN grep -v "#.*\<dev\>" /tmp/build/environment.yml > /tmp/build/filtered_environment.yml
 RUN umask 0002 && /opt/conda/bin/conda env create -f /tmp/build/filtered_environment.yml && /opt/conda/bin/conda clean -afy && sudo chown -R :conda /opt/conda
 COPY --from=gadgetron_cudabuild --chown=$USER_UID:conda /opt/package /opt/conda/envs/gadgetron/
@@ -122,7 +128,9 @@ ENTRYPOINT [ "/tini", "--", "/opt/entrypoint.sh" ]
 
 FROM gadgetron_baseimage AS gadgetron_rt_nocuda
 ARG USER_UID
+ARG HOME
 USER ${USER_UID}
+RUN mkdir -p ${HOME}/.cache/conda/notices && sudo chown -R ${USER_UID}:conda ${HOME}/.cache/conda/notices
 RUN grep -v "#.*\<cuda\|dev\>" /tmp/build/environment.yml > /tmp/build/filtered_environment.yml
 RUN umask 0002 && /opt/conda/bin/conda env create -f /tmp/build/filtered_environment.yml && /opt/conda/bin/conda clean -afy && sudo chown -R :conda /opt/conda
 COPY --from=gadgetron_nocudabuild --chown=$USER_UID:conda /opt/package /opt/conda/envs/gadgetron/
diff --git a/conda/meta.yaml b/conda/meta.yaml
index bcb3933c8..aefd519c9 100644
--- a/conda/meta.yaml
+++ b/conda/meta.yaml
@@ -12,7 +12,7 @@ source:
 requirements:
   build:
     - armadillo>=9.900.5
-    - boost=1.76.0
+    - boost=1.80.0
     - cmake>=3.21.3
     - cuda-libraries-dev=11.6.1           # [linux64]
     - cuda-libraries=11.6.1               # [linux64]
@@ -26,11 +26,11 @@ requirements:
     - gxx_linux-64=9.4.0                  # [linux64]
     - gtest=1.10.0
     - howardhinnant_date=3.0.1
-    - ismrmrd::ismrmrd=1.12.0
+    - ismrmrd::ismrmrd=1.13.1
     - ismrmrd::ismrmrd-python>=1.9.8
     - libblas=*=*mkl
     - libcurl=7.79.1
-    - libxml2=2.9.12
+    - libxml2=2.9
     - mkl>=2022.0.0
     - mkl-include>=2022.0.0
     - ismrmrd::mrd-storage-server=0.0.12
@@ -41,23 +41,23 @@ requirements:
     - pugixml=1.11.4
     - pyfftw>=0.12.0
     - pyyaml>=6.0
-    - python>=3.9.7
+    - python=3.9
     - gadgetron::range-v3>=0.11.0
     - sysroot_linux-64=2.17
   run:
     - armadillo>=9.900.5
-    - boost=1.76.0
+    - boost=1.80.0
     - cuda-libraries=11.6.1               # [linux64]
     - cuda-runtime=11.6.1                 # [linux64]
     - dcmtk=3.6.1
     - fftw=3.3.9
     - gadgetron::gadgetron-python>=1.4.1
-    - ismrmrd::ismrmrd=1.12.0
+    - ismrmrd::ismrmrd=1.13.1
     - ismrmrd::ismrmrd-python>=1.9.8
     - jq>=1.6
     - libblas=*=*mkl
     - libcurl=7.79.1
-    - libxml2=2.9.12
+    - libxml2=2.9
     - memkind>=1.10.1
     - mkl>=2022.0.0
     - ismrmrd::mrd-storage-server=0.0.12
@@ -65,13 +65,13 @@ requirements:
     - onnxruntime=1.10.0
     - pugixml=1.11.4
     - pyfftw>=0.12.0
-    - python>=3.9.7
+    - python=3.9
     - scipy=1.7.1
     - sysroot_linux-64=2.17               # [linux64]
 
 test:
   requires:
-    - ismrmrd::siemens_to_ismrmrd=1.2.6
+    - ismrmrd::siemens_to_ismrmrd=1.2.8
 
 about:
   home: https://github.com/gadgetron/gadgetron
diff --git a/conda/package.sh b/conda/package.sh
index 2d64a3f0d..e9fc2b7d5 100755
--- a/conda/package.sh
+++ b/conda/package.sh
@@ -15,7 +15,7 @@ output_path="$(dirname "$0")/build_pkg"
 
 # Build up channel directives
 channels=(
-  nvidia
+  nvidia/label/cuda-11.6.1
   ismrmrd
   gadgetron
   conda-forge
diff --git a/doc/source/obtaining.md b/doc/source/obtaining.md
index b7f1f53a3..692372c98 100644
--- a/doc/source/obtaining.md
+++ b/doc/source/obtaining.md
@@ -9,16 +9,16 @@ The Gadgetron can be installed in a [conda](https://conda.io) environment. To in
 ```yaml
 name: gadgetron
 channels:
-  - nvidia
-  - ismrmrd
+- ismrmrd
   - gadgetron
+  - nvidia/label/cuda-11.6.1
   - conda-forge
   - bioconda
   - defaults
   - intel
 dependencies:
-  - gadgetron>=4.3
-  - siemens_to_ismrmrd>=1.2.4
+  - gadgetron>=4.4.3
+  - siemens_to_ismrmrd>=1.2.6
 ```
 
 And create the environment with:
diff --git a/environment.yml b/environment.yml
index 33a1a9d89..78e7dd124 100644
--- a/environment.yml
+++ b/environment.yml
@@ -2,26 +2,32 @@ name: gadgetron
 channels:
   - ismrmrd
   - gadgetron
-  - nvidia
+  - nvidia/label/cuda-11.6.1
   - conda-forge
   - bioconda
   - defaults
   - intel
 dependencies:
-  - anaconda-client=1.8.0                 # dev
+  - anaconda-client=1.11                  # dev
   - armadillo=9.900.5                     # dev
-  - boost=1.76.0
-  - breathe=4.32.0                        # dev
+  - boost=1.80.0
+  - breathe=4.34                          # dev
   - cmake=3.21.3                          # dev
-  - conda-build=3.21.9                    # dev
-  - conda-verify=3.4.2                    # dev
+  - conda-build=3.23                      # dev
+  - conda-verify=3.1                      # dev
+  - cuda-cudart=11.6.55                   # cuda
+  - cuda-cudart-dev=11.6.55               # cuda, dev
+  - cuda-cccl=11.6.55                     # cuda
+  - cuda-driver-dev=11.6.55               # cuda, dev
   - cuda-libraries-dev=11.6.1             # cuda, dev
   - cuda-libraries=11.6.1                 # cuda
   - cuda-runtime=11.6.1                   # cuda
   - cuda-nvcc=11.6.112                    # cuda, dev
+  - cuda-nvrtc=11.6                       # cuda
+  - cuda-nvrtc-dev=11.6                   # cuda, dev
   - dcmtk=3.6.1
-  - deepdiff=5.8.1
-  - doxygen=1.9.2                         # dev
+  - deepdiff=5.8
+  - doxygen=1.9                           # dev
   - fftw=3.3.9
   - gadgetron::gadgetron-python=1.4.1
   - gcc_linux-64=9.4.0                    # dev
@@ -32,23 +38,23 @@ dependencies:
   - h5py=3.2.1
   - hdf5=1.10.6
   - howardhinnant_date=3.0.1              # dev
-  - ismrmrd::ismrmrd=1.12.0
+  - ismrmrd::ismrmrd=1.13.1
   - ismrmrd::ismrmrd-python>=1.9.8
   - junitparser=2.7.0
   - jupyter=1.0.0                         # dev
   - jq=1.6
   - libblas=*=*mkl
   - libcurl=7.79.1                        # dev
-  - libxml2=2.9.12                        # dev
+  - libxml2=2.9                           # dev
   - make=4.3                              # dev
   - matplotlib=3.4.3                      # dev
   - memkind=1.10.1
   - mkl>=2022.0.0
   - mkl-include>=2022.0.0                 # dev
   - ismrmrd::mrd-storage-server=0.0.12
-  - ninja=1.10.2                          # dev
+  - ninja=1.10                            # dev
   - nlohmann_json=3.10.4                  # dev
-  - numpy=1.22.1
+  - numpy=1.22
   - onnxruntime=1.10.0
   - pyyaml=6.0                            # dev
   - pip=21.2.4                            # dev
@@ -56,15 +62,17 @@ dependencies:
   - plplot=5.15.0
   - pugixml=1.11.4                        # dev
   - pyfftw=0.12.0
-  - python=3.9.7
+  - python=3.9
   - gadgetron::range-v3=0.11.0
   - recommonmark=0.7.1                    # dev
   - scipy=1.7.1
   - shellcheck=0.7.2                      # dev
-  - ismrmrd::siemens_to_ismrmrd=1.2.6
+  - ismrmrd::siemens_to_ismrmrd=1.2.8
   - sphinx=4.4.0                          # dev
   - sphinx_rtd_theme=0.4.3                # dev
   - sysroot_linux-64=2.17
-  - valgrind=3.17.0                       # dev
-  - xsdata=22.2
-  - yq=2.13.0                             # dev
+  - valgrind=3.17                         # dev
+  - xsdata>=22.2
+  - yq=2.13                               # dev
+
+
diff --git a/toolboxes/core/gpu/check_CUDA.h b/toolboxes/core/gpu/check_CUDA.h
index f59b1f1ce..6b06d3b84 100644
--- a/toolboxes/core/gpu/check_CUDA.h
+++ b/toolboxes/core/gpu/check_CUDA.h
@@ -18,7 +18,7 @@ namespace Gadgetron {
       throw cuda_error(errorCode);
     }
 #ifdef DEBUG
-    cudaThreadSynchronize();
+    cudaDeviceSynchronize();
     errorCode = cudaGetLastError();
     if (errorCode != cudaSuccess) {
       throw cuda_error(errorCode);
diff --git a/toolboxes/core/gpu/cuSparseMatrix.cu b/toolboxes/core/gpu/cuSparseMatrix.cu
index f623bfb40..2c4d8de23 100644
--- a/toolboxes/core/gpu/cuSparseMatrix.cu
+++ b/toolboxes/core/gpu/cuSparseMatrix.cu
@@ -2,6 +2,8 @@
 #include <thrust/extrema.h>
 #include <thrust/device_ptr.h>
 #include "cuNDArray_math.h"
+#include <cusparse.h>
+
 using namespace Gadgetron;
 
 template<class T>
@@ -33,10 +35,10 @@ template<class T> void Gadgetron::sparseMV(T alpha,T beta, const cuCsrMatrix<T>
 
 	size_t bufferSize;
 	auto handle =  cudaDeviceManager::Instance()->lockSparseHandle();
-	cusparseSpMV(handle, trans, &alpha,mat.descr,dnvec_in.get(),&beta,dnvec_out.get(),cuda_datatype<T>(),CUSPARSE_CSRMV_ALG2,&bufferSize);
+	cusparseSpMV(handle, trans, &alpha,mat.descr,dnvec_in.get(),&beta,dnvec_out.get(),cuda_datatype<T>(),CUSPARSE_SPMV_CSR_ALG2,&bufferSize);
 	cuNDArray<char> buffer(bufferSize);
 
-	cusparseStatus_t status = cusparseSpMV(handle, trans, &alpha,mat.descr,dnvec_in.get(),&beta,dnvec_out.get(),cuda_datatype<T>(),CUSPARSE_CSRMV_ALG2, buffer.data());
+	cusparseStatus_t status = cusparseSpMV(handle, trans, &alpha,mat.descr,dnvec_in.get(),&beta,dnvec_out.get(),cuda_datatype<T>(),CUSPARSE_SPMV_CSR_ALG2, buffer.data());
 
 	cudaDeviceManager::Instance()->unlockSparseHandle();
 	if (status != CUSPARSE_STATUS_SUCCESS){
@@ -73,10 +75,10 @@ template<class T> void Gadgetron::sparseMM(T alpha,T beta, const cuCsrMatrix<T>
 	auto dnmat_in = create_DnMat(const_cast<cuNDArray<T>&>(mat_in));
 	auto dnmat_out = create_DnMat(mat_out);
 	size_t bufferSize;
-	CUSPARSE_CALL(cusparseSpMM_bufferSize(handle, trans, CUSPARSE_OPERATION_NON_TRANSPOSE, &alpha, mat.descr, dnmat_in.get(), &beta, dnmat_out.get(), cuda_datatype<T>(),CUSPARSE_CSRMM_ALG1, &bufferSize));
+	CUSPARSE_CALL(cusparseSpMM_bufferSize(handle, trans, CUSPARSE_OPERATION_NON_TRANSPOSE, &alpha, mat.descr, dnmat_in.get(), &beta, dnmat_out.get(), cuda_datatype<T>(),CUSPARSE_SPMM_CSR_ALG1, &bufferSize));
 	cuNDArray<char> buffer(bufferSize);
 
-	CUSPARSE_CALL(cusparseSpMM(handle, trans, CUSPARSE_OPERATION_NON_TRANSPOSE, &alpha, mat.descr, dnmat_in.get(), &beta, dnmat_out.get(), cuda_datatype<T>(),CUSPARSE_CSRMM_ALG1, buffer.data()));
+	CUSPARSE_CALL(cusparseSpMM(handle, trans, CUSPARSE_OPERATION_NON_TRANSPOSE, &alpha, mat.descr, dnmat_in.get(), &beta, dnmat_out.get(), cuda_datatype<T>(),CUSPARSE_SPMM_CSR_ALG1, buffer.data()));
 	cudaDeviceManager::Instance()->unlockSparseHandle();
 
 }
diff --git a/toolboxes/dwt/gpu/cuNDDWT.cu b/toolboxes/dwt/gpu/cuNDDWT.cu
index 4552b540c..2a71bde20 100644
--- a/toolboxes/dwt/gpu/cuNDDWT.cu
+++ b/toolboxes/dwt/gpu/cuNDDWT.cu
@@ -139,7 +139,7 @@ template<class T, unsigned int D, unsigned int WD> void Gadgetron::DWT1( cuNDArr
 
 	const typename intd<D>::Type dims = vector_td<int,D>( from_std_vector<size_t,D>(*(in->get_dimensions())));
 	dwt_kernel<T,D,WD><<<dimGrid,dimBlock>>>(dims, in->get_data_ptr(),out->get_data_ptr(),dim,wavelet,shift);
-	cudaThreadSynchronize();
+	cudaDeviceSynchronize();
 	CHECK_FOR_CUDA_ERROR()
 	*out *= T(1.0/std::sqrt(sum(wavelet)));
 
diff --git a/toolboxes/mri/hyper/CSI_utils.cu b/toolboxes/mri/hyper/CSI_utils.cu
index 8c3651a24..7e77678f4 100644
--- a/toolboxes/mri/hyper/CSI_utils.cu
+++ b/toolboxes/mri/hyper/CSI_utils.cu
@@ -63,7 +63,7 @@ void Gadgetron::CSI_dft(cuNDArray<complext<T> >* kspace,
 		// Invoke kernel
 		dft_kernel<T><<<dimGrid, dimBlock>>>(kspace->get_data_ptr()+i*elements,tspace->get_data_ptr()+i*t_elements,frequencies->data(),dims[0],dims[1], frequencies->size(),dte,dtt);
 		CHECK_FOR_CUDA_ERROR();
-		cudaThreadSynchronize();
+		cudaDeviceSynchronize();
 
 	}
 
diff --git a/toolboxes/nfft/gpu/cuGriddingConvolution.cu b/toolboxes/nfft/gpu/cuGriddingConvolution.cu
index f8134138e..e4ca31aa8 100755
--- a/toolboxes/nfft/gpu/cuGriddingConvolution.cu
+++ b/toolboxes/nfft/gpu/cuGriddingConvolution.cu
@@ -2,6 +2,8 @@
 #include "cuGriddingConvolution.h"
 
 #include <thrust/binary_search.h>
+#include <thrust/extrema.h>
+#include <thrust/sort.h>
 
 #include "cuNDArray_elemwise.h"
 #include "cuNDArray_utils.h"


Test patch:
diff --git a/test/cuVector_td_test_kernels.cu b/test/cuVector_td_test_kernels.cu
index c10485d06..47df2079c 100644
--- a/test/cuVector_td_test_kernels.cu
+++ b/test/cuVector_td_test_kernels.cu
@@ -18,7 +18,7 @@ template<class T, unsigned int D> void Gadgetron::test_abs(cuNDArray< vector_td<
 	dim3 dimBlock(std::min(cudaDeviceManager::Instance()->max_griddim(),(int)data->get_number_of_elements()));
 	dim3 dimGrid((dimBlock.x-1)/data->get_number_of_elements()+1);
 	abs_kernel<<<dimGrid,dimBlock>>>(data->get_data_ptr(),data->get_number_of_elements());
-	cudaThreadSynchronize();
+	cudaDeviceSynchronize();
 	CHECK_FOR_CUDA_ERROR();
 }
 
@@ -32,7 +32,7 @@ template<class T, unsigned int D> thrust::device_vector<T> Gadgetron::test_norm(
 
 	thrust::device_vector<T> out(data->get_number_of_elements());
 	thrust::transform(data->begin(),data->end(),out.begin(),test_norm_functor<T,D>());
-	cudaThreadSynchronize();
+	cudaDeviceSynchronize();
 	CHECK_FOR_CUDA_ERROR();
 	return out;
 }
@@ -48,7 +48,7 @@ template<class T, unsigned int D> thrust::device_vector<T> Gadgetron::test_min(c
 
 	thrust::device_vector<T> out(data->get_number_of_elements());
 	thrust::transform(data->begin(),data->end(),out.begin(),test_min_functor<T,D>());
-	cudaThreadSynchronize();
+	cudaDeviceSynchronize();
 	CHECK_FOR_CUDA_ERROR();
 	return out;
 }
@@ -63,7 +63,7 @@ template<class T, unsigned int D> thrust::device_vector<T> Gadgetron::test_max(c
 
 	thrust::device_vector<T> out(data->get_number_of_elements());
 	thrust::transform(data->begin(),data->end(),out.begin(),test_max_functor<T,D>());
-	cudaThreadSynchronize();
+	cudaDeviceSynchronize();
 	CHECK_FOR_CUDA_ERROR();
 	return out;
 }
diff --git a/test/integration/run_gadgetron_test.py b/test/integration/run_gadgetron_test.py
index ade240fe3..6b5facb90 100755
--- a/test/integration/run_gadgetron_test.py
+++ b/test/integration/run_gadgetron_test.py
@@ -128,7 +128,7 @@ def stream_data_to_gadgetron(echo_handler, storage_address, *, input, output, co
                    stderr=log_stderr)
 
 
-def wait_for_storage_server(port, proc, retries=20):
+def wait_for_storage_server(port, proc, retries=50):
     for i in range(retries):
         try:
             urllib.request.urlopen(f"http://localhost:{port}/healthcheck")
diff --git a/toolboxes/mri/pmri/gpu/b1map_test.cu b/toolboxes/mri/pmri/gpu/b1map_test.cu
index 0a7719262..4b8356777 100644
--- a/toolboxes/mri/pmri/gpu/b1map_test.cu
+++ b/toolboxes/mri/pmri/gpu/b1map_test.cu
@@ -33,7 +33,7 @@ int main( int argc, char** argv)
   // Compute CSM
   boost::shared_ptr< cuNDArray<float_complext::Type> > csm = estimate_b1_map<float,2>( &device_data );
   
-  cudaThreadSynchronize(); cutStopTimer( timer );
+  cudaDeviceSynchronize(); cutStopTimer( timer );
   time = cutGetTimerValue( timer ); printf("done: %.1f ms.", time ); fflush(stdout);
 
   // Output result