Skip to content

NumCalc

Fabian Brinkmann edited this page Aug 3, 2022 · 6 revisions

The folder NumCalc in the Mesh2HRTF repository contains the source code for calculating HRTFs in the folder src, the compiled binary in the folder bin (see installation), and functions/scripts to optimally run NumCalc on Mesh2HRTF projects. The following explains how different ways to run NumCalc.

Single instance use

So most basic use is to run the command NumCalc in a terminal in a sub-directory NumCalc/source_x of a Mesh2HRTF project folder (directories containing a file named NC.inp). This will start a single NumCalc instance that will calculate the HRTF frequency by frequency.

The results are saved in the the folder be.out, and the shell output is written to the file NC.out. For details refer to Mesh2HRTF Project Folder.

Manual multiple instance use (introduced in Mesh2HRTF 1.0.0)

Multiple NumCalc instances can run in parallel to speed up the calculations using the parameters istart and iend giving the first and last frequency step to be simulated (not the frequency in Hz). For example, four parallel instances could be started with the command:

NumCalc -istart 1 -iend 25 & NumCalc -istart 26 -iend 50 & NumCalc -istart 51 -iend 75 & NumCalc -istart 76 -iend 100

The results would be saved as in the example above in the folder be.out and the names of the output files in this case would be NC1-25.out, NC26-50.out, NC51-75.out, and NC76-100.out.

Optimized multiple instance use (introduced in Mesh2HRTF 1.0.0)

The function manage_numcalc (cf. Mesh2HRTF API available only in Python) or the script manage_numcalc_script.py on the repository folder NumCalc can be used to parallelize NumCalc in a close to optimal manner. The NumCalc manager monitors available resources (available threads, CPU, RAM) and starts a new NumCalc instance whenever possible.

Additional command line arguments (introduced in Mesh2HRTF 1.0.0)

  • The required RAM per frequency step can be estimated with the flag -estimate_ram. The estimated values in GB are written to Memory.txt. This is used by the NumCalc manager and the estimates can be read with the function read_ram_etimates from the Mesh2HRTF API
  • You can control the maximum number of iterations done for each frequency step by passing the -nitermax option followed by the number, i.e. NumCalc -nitermax 10. This should usually not be required.
  • Adding >NumCalc.txt to the command creates an additional log file.
  • Adding 2>NumCalcErr.txt to the command creates an additional error log file, i.e. NumCalc >NumCalc.txt 2>NumCalcErr.txt

Structure of the input and output files

Structure of NC.inp

Nodes and Elements

Output File Structure