New McXtrace release with GPU support

McXtrace 3.0 “next generation” release is now available, with a completely rewritten code-generator and thereby support for GPU-acceleration through the OpenACC programming model.

McXtrace is a general Monte Carlo ray-tracing software for simulation X-ray beamlines and experiments, distributed under the open source license of GPL.

Currently, the active partners behind the McXtrace project is DTU Physics and Synchrotron SOLEIL. McXtrace was started in 2009 as a collaborative effort between the Niels Bohr Insitute,  DTU Physics and European Synchrotron Radiation Facility, partnering with the company SAXSLAB Aps (now part of Xenocs). Initial funding came from a grant under the NaBiIT program of the Danish Strategic Research Council DSF.

It is built upon the code base of the proven and succesful neutron ray-tracing package McStas and today McXtrace and McStas share a central code repository.

McXtrace 3.0 installation:

  • Installation instructions for McXtrace-3.0 and support libraries may be found on our the McCode github-site:
  • OpenACC acceleration is at present available out of the box on Linux. 
  • On Windows it is possible to target GPU-acceleration through Windows Subsystem For Linux v2: WSL2. 
  • The present McXtrace-3.0 implementation relies the concept managed memory, which is at the time of writing only supported by the Linux version of the NVHPC-kit (downloadable from

For more information on the GPU-features of the release, please consult the CHANGES_McXtrace document on GitHub

( and the section “Migrating from McStas 2.x to 3.x (and McXtrace 1.x to 3.x)” at 


The perl-suite of tools are no longer actively supported. They may still work.


The platforms Debian/Ubuntu and Fedora for Linux, 64 bit Windows 10, and recent 64 bit macOS (big Sur and newer) are supported. For FreeBSD you may build from source, an entry into the ports system is pending.

Components and Instruments:

  • Most components and instruments work out of the box. See for details.
  • Monitor_nD.comp: the uservar utility should now be given a string insted of a token name to measure a USERVAR entity tagged onto the photon. The string is used to look-up the name of the variable which should be declared in the USERVARS-section of the instrument file.
Share this content