k-Wave Matlab plugin¶
This recipe describes compilation of kspaceFirstOrder-OMP
binary, which is a part of the k-Wave Matlab plugin.
1. Load modules:
2. Compile HDF5 locally:
# https://www.hdfgroup.org/downloads/hdf5/source-code/
wget https://hdf-wordpress-1.s3.amazonaws.com/wp-content/uploads/manual/HDF5/HDF5_1_12_2/source/hdf5-1.12.2.tar.gz
mkdir hdf5-install
tar -xvzf hdf5-1.12.2.tar.gz
cd hdf5-1.12.2
./configure --enable-hl --prefix=/scratch/$USER/tools/hdf5-install
make -j 4
make install
3. Compile Szip locally:
# https://support.hdfgroup.org/doc_resource/SZIP/
wget https://support.hdfgroup.org/ftp/lib-external/szip/2.1.1/src/szip-2.1.1.tar.gz
tar -xvzf szip-2.1.1.tar.gz
mkdir szip-install
cd szip-2.1.1
./configure --prefix=/scratch/$USER/tools/szip-install
make
make install
**4. Compile kspaceFirstOrder-OMP with Intel + MKL: **
The Makefile was modified as follows:
COMPILER = Intel
LINKING = STATIC
MKL_DIR=$(MKLROOT)
HDF5_DIR=/scratch/$(USER)/tools/hdf5-install
ZLIB_DIR=$(ZLIB_ROOT)
SZIP_DIR=/scratch/$(USER)/tools/szip-install
This generates kspaceFirstOrder-OMP executable:
[<NetID>@login02 kspaceFirstOrder-OMP]$ ./kspaceFirstOrder-OMP
┌───────────────────────────────────────────────────────────────┐
│ kspaceFirstOrder-OMP v1.3 │
├───────────────────────────────────────────────────────────────┤
│ Usage │
├───────────────────────────────────────────────────────────────┤
│ Mandatory parameters │
├───────────────────────────────────────────────────────────────┤
│ -i <file_name> │ HDF5 input file │
│ -o <file_name> │ HDF5 output file │
├───────────────────────────────┴───────────────────────────────┤
│ Optional parameters │
├───────────────────────────────┬───────────────────────────────┤
│ -t <num_threads> │ Number of CPU threads │
│ │ (default = 1) │
│ -r <interval_in_%> │ Progress print interval │
│ │ (default = 5%) │
│ -c <compression_level> │ Compression level <0,9> │
│ │ (default = 0) │
│ --benchmark <time_steps> │ Run only a specified number │
│ │ of time steps │
│ --verbose <level> │ Level of verbosity <0,2> │
│ │ 0 - basic, 1 - advanced, │
│ │ 2 - full │
│ │ (default = basic) │
│ -h, --help │ Print help │
│ --version │ Print version and build info │
├───────────────────────────────┼───────────────────────────────┤
│ --checkpoint_file <file_name> │ HDF5 checkpoint file │
│ --checkpoint_interval <sec> │ Checkpoint after a given │
│ │ number of seconds │
│ --checkpoint_timesteps <step> │ Checkpoint after a given │
│ │ number of time steps │
├───────────────────────────────┴───────────────────────────────┤
│ Output flags │
├───────────────────────────────┬───────────────────────────────┤
│ -p │ Store acoustic pressure │
│ │ (default output flag) │
│ │ (the same as --p_raw) │
│ --p_raw │ Store raw time series of p │
│ --p_rms │ Store rms of p │
│ --p_max │ Store max of p │
│ --p_min │ Store min of p │
│ --p_max_all │ Store max of p (whole domain) │
│ --p_min_all │ Store min of p (whole domain) │
│ --p_final │ Store final pressure field │
├───────────────────────────────┼───────────────────────────────┤
│ -u │ Store ux, uy, uz │
│ │ (the same as --u_raw) │
│ --u_raw │ Store raw time series of │
│ │ ux, uy, uz │
│ --u_non_staggered_raw │ Store non-staggered raw time │
│ │ series of ux, uy, uz │
│ --u_rms │ Store rms of ux, uy, uz │
│ --u_max │ Store max of ux, uy, uz │
│ --u_min │ Store min of ux, uy, uz │
│ --u_max_all │ Store max of ux, uy, uz │
│ │ (whole domain) │
│ --u_min_all │ Store min of ux, uy, uz │
│ │ (whole domain) │
│ --u_final │ Store final acoustic velocity │
├───────────────────────────────┼───────────────────────────────┤
│ -s <time_step> │ When data collection begins │
│ │ (default = 1) │
│ --copy_sensor_mask │ Copy sensor mask to the │
│ │ output file │
└───────────────────────────────┴───────────────────────────────┘
┌───────────────────────────────────────────────────────────────┐
│ !!! K-Wave experienced a fatal error !!! │
├───────────────────────────────────────────────────────────────┤
│ Error: Input file was not specified. │
├───────────────────────────────────────────────────────────────┤
│ Execution terminated │
└───────────────────────────────────────────────────────────────┘
Possible problems¶
Catastrophic error: could not set locale¶
Sometimes, Intel compiler suite may be sensitive to the regional settings ("locale"). For instance, the regional setting on your local machine might be different from those on the server. In this case, you might get the following compilation error:
This can be fixed by exporting the correct regional environmental variables:
hdf5.h
include file is not found¶
This can be fixed by exporting hdf5
's include
folder location to CPATH
: