Compiling COBALT

To install COBALT, several dependencies need to be installed. The most convenient method is by using the Spack package manager.

If provided, an existing Spack environment can be used. In this case, one can immediately proceed to the compilation of COBALT. If not environment is provided, or the CPU architecture of the provided spack environment does not match the target CPU, an new spack environment shall be created. Please refer to the

Quick Links

Automatic Spack Installation

Note

These instructions were sourced from the cobalt-installation repository.

  1. First, clone the repository:

git clone https://git.astron.nl/RD/cobalt-installation
  1. Ensure a cobalt user exist on all target machines. If not, create one:

useradd cobalt
  1. Create the /data/cobalt directory on each target machine:

mkdir -p /data/cobalt
chown cobalt:cobalt /data/cobalt
  1. Then, run the installation script:

cd cobalt-installation/infra
chmod +x install_cobalt.sh
./install_cobalt.sh

The script will create a new spack environment.

Manual Spack Installation

In this section, instructions are provided to prepare the COBALT spack environment.

Creating a New Spack Environment

If no compatible spack environment is available or if your system’s CPU architecture differs from the provided environment, you will need to create a new one. We assume that spack is already installed. Instructions to install spack can be found here.

  1. First, enable spack:

source /var/scratch/root/spack/v0.22.1/share/spack/setup-env.sh
  1. Then, create a new spack environment using the provided environment.yaml file in the root of the repository:

spack env create lofar
spack env activate lofar
cp environment.yaml $SPACK_ENV/spack.yaml

3. Finally, install the environment. Running spack install may take up to a couple hours and builds and installs roughly 100 packages.

spack install
  1. Create module files by copying the modules.yaml file in the root directory:

cp modules.yaml ~/.spack/modules.yaml
spack module tcl refresh -y
  1. Provided that your shell is set-up properly, or you sourced /etc/profile.d/modules.sh, you can now add the module path, e.g.:

module use /opt/spack/0.22.1/share/spack/modules/linux-debian12-zen2/gcc/12.2.0

6. Running module avail should list all packages installed through Spack. Note that one different systems the architecture, in our case zen2, the output may be different.

Compiling COBALT

  1. First, activate the spack environment by running:

module load spack/12.2.0 # COBALT is tested with spack 12.2.0, but other versions may work as well

Note

Check if the packages are loaded by running module list.

  1. Then, load the required packages:

module load dal2
source /var/scratch/root/spack/v0.22.1/share/spack/setup-env.sh
module load binutils cuda log4cplus postgresql openblas diffutils dal2 \
            fftw openmpi boost pqxx casacore python numactl unittest-cpp \
            hdf5 py-lxml gcc gmake cmake openmpi
  1. Now, clone COBALT and compile it from source:

git clone https://git.astron.nl/cobalt/cobalt
cd cobalt
cmake -Bbuild/gnucxx11_optarch -DUSE_MPI=ON .
cd build/gnucxx11_optarch

Warning

If you want to create a debug build, you can set the directory prefix accordingly. For example:

cmake -Bbuild/gnucxx11_debug -DUSE_MPI=ON .

Furthermore, ensure that the USE_MPI directive is set to ON. This can be done using the following command: ccmake .

  1. Run make:

make -j
  1. Finally, install the compiled binaries:

make install

Common Issues

Compiling COBALT on DAS-6

To compile COBALT on DAS-6, the following script can be used to activate the required modules:

. /var/scratch/root/cobalt-installation/infra/activate_cobalt_das6.sh

Please note that this script assume the AMD zen2 architecture. If you are using a different architecture, please modify the script to point to the right spack environment.

Note

To make the script available on every login, add the following line to your .bashrc file:

# ...
source /var/scratch/root/cobalt-installation/infra/activate_cobalt_das6.sh