CMake options and targets¶
FORGE needs CMake 3.17 or newer and a C++17 compiler. Build and install FORGE shows how to use these.
Options¶
| Option | Default | Effect |
|---|---|---|
METAL_COMPUTE |
ON (macOS only) |
Build the Metal backend. Ignored on Linux. Turned off automatically if the Metal toolchain (xcrun metal) is missing. |
CUDA_COMPUTE |
OFF |
Build the CUDA backend. Needs the CUDA toolkit. |
MPISupport |
ON |
Build the MPI programs. Requires Boost.MPI; the programs are built only if CMake also finds MPI. |
BUILD_FORGEVIEW |
ON |
Build the forgeview terminal monitor. |
BUILD_SHARED_LIBS |
ON |
Build ForgeCommon_* as shared libraries. |
STATIC_DEPS |
OFF |
Link third-party libraries statically for redistributable binaries. Forces MPISupport=OFF. Needs ARMA_HOME in the environment and -DISMRMRD_LIBRARIES=<path to libismrmrd.a>. |
CMAKE_CUDA_ARCHITECTURES |
75;80;86;89;90;120 |
CUDA compute capabilities to compile for (Turing to Blackwell). Set native to build for the installed GPU only. |
The library and programs are compiled with -O3, plus -flto on macOS.
Targets¶
Every build has a CPU backend. A Metal or CUDA build adds a second, independent copy of the library and programs. Target names carry the backend as a suffix.
| Target | Built when |
|---|---|
ForgeCommon_cpu |
always |
forgeSense_cpu, forgePcSense_cpu, forgePcSenseTimeSeg_cpu, oscillateRecon_cpu, gridCoilImages_cpu |
always |
ForgeCommon_metal and ..._metal versions of the programs |
macOS with METAL_COMPUTE=ON and the Metal toolchain |
ForgeCommon_cuda and ..._cuda versions of the programs |
CUDA_COMPUTE=ON |
forgeSenseMPI_<backend>, forgePcSenseMPI_<backend>, forgePcSenseMPI_TS_<backend> |
MPISupport=ON and MPI is found |
GenSyntheticISMRMRD |
always (CPU only) |
forgeview |
BUILD_FORGEVIEW=ON |
cpu_tests |
always |
metal_tests, metal_bench, metal_vecops_bench, metal_profile |
Metal builds |
cuda_tests, cuda_profile |
CUDA builds |
ismrmrd_tests |
Linux |
The program files drop the suffix (forgeSense_metal builds a file called forgeSense), and all of them are written to the top of the build directory, so programs of different backends overwrite each other there. Install to keep them apart.
Install layout¶
cmake --install build --prefix <prefix> writes:
| Path | Content |
|---|---|
<prefix>/bin/<backend>/ |
forgeSense, forgePcSense, forgePcSenseTimeSeg, oscillateRecon, gridCoilImages and the MPI programs, for each backend built (cpu, metal, cuda) |
<prefix>/bin/ |
forgeview, GenSyntheticISMRMRD |
<prefix>/lib/ |
libForgeCommon_<backend> |
The programs find the libraries through their RPATH (../../lib), so the install directory can be moved as a whole. The library headers are not installed.
Dependencies fetched at configure time¶
The first configure downloads these with FetchContent:
| Library | Version | Used for |
|---|---|---|
| spdlog | v1.14.1 | Logging |
| indicators | v2.3 | Text progress bars |
| FTXUI | v6.1.9 | forgeview |
| nlohmann/json | v3.11.3 | forgeview |
The libraries you install yourself are listed in Install the dependencies.