Hi Afni Experts,
I wanted to find out which version of OpenMP is used in the precompiled code (MacOSX and linux) and if it is possible to use openmp 4.5+ with AFNI built from source code? The reason I ask is that OpenMP 4.5+ supports use of GPUs for parallelization with minimal edits so I was curious to looking into this further.
Version 4.5 dates to 2015, and for a compiler that supports it, we can get that date via a command like:
echo | cpp -fopenmp -dM | grep OPENMP
That runs the preprocessor (on empty input) with -fopenmp, shows all predefined macros, and restricts to anything with OPENMP in the name.
Currently, only the macos_10.12_local and linux_fedora_28_shared packages (out of those distributed) seem to come with OpenMP 4.5.
If you want to build AFNI on your own, it isn’t hard (especially on linux). What OS are you using?
Thanks for the info and quick reply. In reading further, it looks like OpenMP 4.0 and above will work for offloading to the GPU instead of CPU. I’m looking into implementing this on our HPC environment (RedHat) and further down the line a docker or singularity container. For the container route I was initially looking at CentOS since it aligns better to RHEL but I’m not tied to it if you have any recommendations.
Just curious, is there any work on this front of adding a switch to some of the more computationally heavy components (e.g. nonlinear warping) to utilize a GPU if present otherwise fallback to CPU parallelization in OpenMP or using something like CUDA (NVIDIA cards only) or OpenACC(opens it up to AMD etc) directly if a GPU is detected?