McStasMcXtrace / McCode

The home of the McStas (neutrons) and McXtrace (x-rays) Monte-Carlo ray-tracing instrument simulation codes.
https://github.com/McStasMcXtrace/McCode/wiki
GNU General Public License v3.0
78 stars 54 forks source link

McXtrace-3.0: SAXS-components need bessel functions. This is not readily available for GPU/OpenACC #1166

Open ebknudsen opened 3 years ago

ebknudsen commented 3 years ago

At present some of the SAXS-sample components:

...have calls to bessel functions j1 and j0 inside TRACE (i.e. the accelerated region in OpenACC). These are available in nvidia-CUDA but only as device-functions and also as a gnu99 extension for the CPU. At present that means that the standard way of compiling for OpenACC (nvc) does not work. As a workaround these components have been declared NOACC and link with GSL.

Possible ways forward:

  1. Port the relevant gsl-code.
  2. Somehow compile special functions using cuda/gcc where relevant.
  3. wait for nvidia to make these functions available as standard.
ebknudsen commented 3 years ago

A related issue is the numerical integration routines used by Undulator.comp. This is also NOACC since it also uses GSL for this functionality. Wiggler and BM and a simplified Undulator would likely also be using Bessel functions