Parallelization

The OOMMF Oxs 3D solvers (oxsii and boxsi) can be built thread-enabled to allow parallel processing on multi-processor/multi-core machines. In order to build and run a parallel version of OOMMF, you must have a thread-enabled version of Tcl. Most standard binary releases of Tcl today are thread-enabled, so OOMMF releases that include pre-built executables are built thread-enabled. If you build OOMMF from source, then by default OOMMF will be built thread-enabled if your Tcl is thread-enabled. As explained earlier, you can check thread build status with the tclsh oommf.tcl +platform command. If you want to force a non-threaded build of OOMMF, then edit the config/platforms/ file for your platform. In the section labeled LOCAL CONFIGURATION, you will find a line that looks like
# $config SetValue oommf_threads 0
Uncomment this line (i.e., remove the leading `#' character) to force a non-threaded build. Then run
tclsh oommf.tcl pimake distclean
tclsh oommf.tcl pimake
from the OOMMF root directory to create a fresh build.

You can use the tclsh oommf.tcl +platform command to see the default number of compute threads that will be run by the Oxs 3D solver programs oxsii and boxsi. You can modify the default as explained in the Check Your Platform Configuration and Local Customizations sections, or you can override the default at run time via the command line option -threads to oxsii and boxsi.

Some multi-processor machines have a non-uniform memory architecture (NUMA), which means that although each processor can access all of system memory, some parts of memory can be accessed faster than others. Typically this is accomplished by dividing the system memory and processors into “nodes.” Memory accesses within a node are faster than accesses between nodes, and depending on the architecture access latency and bandwidth may be different between different node pairs. Examples of machines with NUMA include some multi-processor AMD Opteron and Intel Xeon boxes.

Computer programs such as OOMMF can run on NUMA machines without making any special allowances for the memory architecture. However, a program that is written to take advantage of the faster local (intra-node) memory accesses can sometimes run significantly faster. OOMMF contains NUMA-aware code, but this code is highly operating system specific. At present, OOMMF can be built with NUMA support only on Linux (32- and 64-bit) systems. To do this, you must install the operating system NUMA support packages “numactl” and “numactl-devel”. The names may vary somewhat between Linux distributions, but the first typically includes the executable numactl and the second includes the header file numa.h. Once the numactl package is installed, you can run the command

numactl --hardware
to get an overview of the memory architecture on your machine. If this shows you have only one node, then there is no advantage to making a NUMA-aware build of OOMMF.

The next step is to edit the config/platforms for your platform. For example, on a 64-bit Linux box this file is config/platforms/linux-x86_64.tcl. In the section labeled LOCAL CONFIGURATION, find the line

# $config SetValue use_numa 1
Edit this to remove the leading `#' character. Alternatively (and, actually, preferably), create a local subdirectory and make a local configuration file with the same platform name; e.g., config/platforms/local/linux-x86_64.tcl on a 64-bit Linux machine. Add the line
$config SetValue use_numa 1
to this file. (The advantage of using a config/platforms/local file is that you can make changes without modifying the original OOMMF source code, which makes it easier to port your local changes to future releases of OOMMF.) If this is done correctly, then the command `tclsh oommf.tcl +platform' will show that NUMA support is enabled. Then simply run `tclsh oommf.tcl pimake distclean' and `tclsh oommf.tcl pimake' from the OOMMF root directory to build a NUMA-aware version of OOMMF.

To activate the NUMA-aware code, you must specify the -numanodes option on the oxsii/boxsi command line, or set the the environment variable OOMMF_NUMANODES. Check the Oxs documention for details.


OOMMF Documentation Team
September 27, 2024