Linux Installation Guide
Setting up Development Environment using Spack
Prerequisites
Before starting, ensure you have the following:
NVIDIA GPU with CUDA support (for GPU acceleration)
NVIDIA Driver installed on your system (if using GPU acceleration) - Check with
nvidia-smicommand - If not installed, follow your distribution’s instructions for NVIDIA driver installation
Installing Spack
Clone Spack repository:
git clone -c feature.manyFiles=true https://github.com/spack/spack.git cd spack git checkout releases/v0.21
Set up Spack environment:
# Add to your ~/.bashrc or ~/.zshrc export SPACK_ROOT=/path/to/spack source $SPACK_ROOT/share/spack/setup-env.sh
Verify installation:
spack --version spack compiler find
Setting up METADA Environment
Create a new Spack environment:
spack env create metada spack env activate metada
Add required packages:
# Core development tools spack add cmake@3.30: ninja gcc # GPU acceleration support spack add cuda@12.1.0 # Scientific computing packages spack add eigen boost # Configuration packages spack add yaml-cpp nlohmann-json # Testing and development tools spack add googletest spack add lcov
Install ng-log from source (since it’s not available in Spack):
git clone --depth 1 https://github.com/ng-log/ng-log.git cd ng-log mkdir build && cd build cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$SPACK_ROOT/opt/spack/linux-ubuntu22.04-x86_64/gcc-12.2.0/ng-log-master ninja ninja install cd ../..
Configure environment:
spack.yaml# Spack environment configuration for METADA spack: # Specify package preferences and variants specs: - cmake@3.10.0: - ninja@1.10.0: - gcc@11.0.0: - cuda@12.1.0 - eigen@3.4.0: - boost@1.74.0: +python +numpy - python@3.8.0: +shared - py-numpy - py-scipy - py-matplotlib - googletest@1.11.0: +gmock - lcov@1.16: - clang@15.0.0: - yaml-cpp - nlohmann-json # Package configuration packages: cuda: buildable: false externals: - spec: cuda@12.1.0 prefix: /usr/local/cuda-12.1 python: variants: +shared version: [3.8.0:] googletest: variants: +gmock version: [1.11.0:] all: compiler: [gcc@11.0.0:] providers: mpi: [openmpi] blas: [openblas] lapack: [openblas] # Compiler configuration compilers: - compiler: spec: gcc@11.0.0 paths: cc: /usr/bin/gcc cxx: /usr/bin/g++ f77: /usr/bin/gfortran fc: /usr/bin/gfortran flags: {} operating_system: ubuntu22.04 target: x86_64 modules: [] environment: {} extra_rpaths: [] # View configuration view: true concretizer: unify: true
Install the environment:
spack install
IDE Setup
Install VS Code:
# For Debian/Ubuntu sudo apt-get install code # For other distributions, download from code.visualstudio.com
Install extensions:
code --install-extension ms-vscode.cpptools code --install-extension ms-vscode.cmake-tools code --install-extension twxs.cmake
Building METADA
Build the project:
cmake -S . -B build -G Ninja \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_CXX_STANDARD=17 \ -DCMAKE_PREFIX_PATH=$SPACK_ROOT/opt/spack/linux-ubuntu22.04-x86_64/gcc-12.2.0/ng-log-master cmake --build build
Running Tests
Execute the test suite:
cd build
ctest --output-on-failure
Troubleshooting
Common issues and solutions:
Spack environment issues: Verify environment activation
Build failures: Check compiler compatibility
Missing dependencies: Use
spack spec metadato verify package resolutionng-log issues: Ensure ng-log is properly installed and CMAKE_PREFIX_PATH includes its installation directory