# A guide to icon-dsl (main branch) build on balfrin with serialization Below is a guide of how to compile icon-dsl on balfrin with serialization. Currently, serialbox library is not in the user environment. You have to install it manually. ## Before you start For the build described in this hackmd, you need to have `env.sh`, `setup.sh`, and `alps_nospack`. You should be able to find `env.sh` and `setup.sh` in `dsl/` folder, and `alps_nospack` in `config/cscs` folder in the icon-dsl branch of icon-exclaim repo as these files have been added from the PR: https://github.com/C2SM/icon-exclaim/pull/283. ## Steps 1. Prepare the uenv image. Details about uenv can be found on https://confluence.cscs.ch/display/KB/UENV+user+environments ```bash git clone https://github.com/eth-cscs/uenv.git cd uenv # run the installation script. # if this is the first time that you are installing uenv, # type "yes" or "y" when prompted whether to update your ~/.bashrc file. ./install --local ``` 2. activate the environment (you need this also for running ICON, so put it in your run scripts or bashrc) ```bash uenv start --view=icon-wcp:icon /scratch/mch/leclairm/uenvs/images/icon.v1.rc4.sqfs ``` You should see something as shown below when you type ```uenv status``` ```bash /user-environment:icon-wcp The tools required to build ICON views: icon (loaded) modules: activate modules spack: configure spack upstream ``` 2. clone the repo and move to the branch you need to work with ```bash git clone git@github.com:C2SM/icon-exclaim.git cd icon-exclaim git submodule update --init --recursive ``` you can execute the following command to avoid entering passphrase while cloning submodules. ```bash eval $(ssh-agent) ssh-add ``` 3. go back to the root directory and clone icon4py and gridtools repos ```bash git clone -b v0.0.11 git@github.com:C2SM/icon4py.git git clone -b v2.3.4 https://github.com/GridTools/gridtools.git ``` 4. Change the gt4py branch in ```base-requirements.txt``` in the root directory of icon4py repository to ```bash gt4py @ git+https://github.com/GridTools/gt4py.git@icon4py_20240521 ``` 5. create python virtual environment in icon4py by running the following script ```bash pushd icon4py python3.10 -m venv .venv source .venv/bin/activate pip install --upgrade pip wheel setuptools pip install -r requirements.txt deactivate popd ``` 6. Copy `dsl/env.sh` and `dsl/setup.sh` to the root directory where you clone icon-exclaim and icon4py. 7. Install serialbox library. ```bash git clone https://github.com/eth-cscs/serialbox2.git cd serialbox2/ mkdir build cd build/ export CC=mpicc export FC=mpif90 export CXX=mpicxx cmake ../ -DSERIALBOX_ENABLE_FORTRAN=ON cmake --build . cmake --build . --target install ``` Now you have to change `SERIALBOX2_ROOT` to your serialbox installation path in the script `env.sh`, for example, ```bash SERIALBOX2_ROOT=/scratch/mch/cong/serialbox2/install ``` 8. Build icon-dsl. Uncomment this line in build_types variable in `setup.sh` ``` build_types=( "build_substitution" "build_substitution_fused" "build_verification" "build_verification_fused" # Exclude serialize for now, as it is broken #"build_serialize" "build_acc" "build_cpu" "build_cpu2py" "build_gpu2py" ) ``` Change `--enable-liskov=serialize` in the following line to `--enable-liskov=substitute` (I have not tried `--enable-liskov=serialize`) ``` build_serialize) build_dir="build_serialize" liskov_option="--enable-serialization --enable-liskov=serialize --disable-liskov-fused" ;; ``` Then, run the `setup.sh` script (note that the setup script and `env.sh` must be at the same directory with icon-exclaim, icon4py, and gridtools) ```bash ./setup.sh build_serialize ```