sunpho84 / nissa

Nissa Is a Set of SU(N) Algorithms
GNU General Public License v3.0
5 stars 13 forks source link

--with-threads-type=none doesn't disable openmp threads automatically in branch timings #37

Open joek93 opened 1 year ago

joek93 commented 1 year ago

Just as the title says... it is simply a ./configure.ac automatism, since AX_OPENMP automatically defines HAVE_OPENMP, which activates openmp threads in the code at preprocessing time in src/threads/threads.hpp.

A possible solution would be to replace #ifdef HAVE_OPENMP with #if THREADS_TYPE == OPENMP_THREADS in src/threads/threads.hpp

sunpho84 commented 1 year ago

In fact, thinking better and in line with #40, one should indeed enable openmpFor if the backend support is given. The THREADS_TYPE does not fit the scheme of #40, as it forbids to run paralell loops on host if parallel loops are enabled on the device. The point is to have a flag which enable automatic parallelization of HOST_LOOP with openmp threads (other backends might be available...), where DEVICE_LOOP would be paralellized with Cuda, if that is available. If Cuda is not available, DEVICE_LOOP would be aliased to HOST_LOOP. Then, another flag is needed to specify the default memory space of Tensors (and Field2). At the moment this is all intermixed...

sunpho84 commented 1 year ago

Please confirm that 46d906295c25ed4d890c84865c7da6c19235bccb fixes this