Skip to content

Building DASH

Claudio Bantaloukas edited this page Jan 3, 2022 · 7 revisions

Building DASH

Make sure your system has been set up correctly!

The instructions in this page will only work if you have followed the instructions in the Provisioning a build machine page.

Building commands

Fetching the source code

Use the following command to clone the dash repository

git clone ssh://[email protected]/ccdc-opensource/dash.git

This will create a directory called dash on your disk.

CMake Configuration

The following command line snippet will configure the build to:

  • Use Ninja to build a Release version of DASH (with full optimisations)
  • Use the Intel Fortran Compiler in its default location
  • Use a copy of winteracter installed under a custom location (the default is C:\wint)
  • Use the dash directory as a location for the source code
  • Use a bld directory as a location for the the generated solution and build products
  • Install DASH under the install directory when selecting the INSTALL target

Windows

call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"

"C:\Program Files\CMake\bin\cmake.exe" ^
    -G Ninja ^
    -S dash ^
    -B bld ^
    -DWINTERACTER_ROOT=C:\winteracter\winteracter-14.10d ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DCMAKE_Fortran_COMPILER="C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/intel64/ifort.exe" ^
    -DCMAKE_INSTALL_PREFIX=install

Linux

source /opt/intel/oneapi/setvars.sh

cmake \
    -G Ninja \
    -S dash \
    -B bld \
    -DWINTERACTER_ROOT=/opt/winteracter/winteracter-linux-14.10d \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_Fortran_COMPILER="/opt/intel/oneapi/compiler/latest/linux/bin/intel64/ifort" \
    -DCMAKE_INSTALL_PREFIX=install

Building from the command line

The following powershell snippet will compile all fortran code using the build directory bld configured using the cmake command above

Windows

call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
"C:\Program Files\CMake\bin\cmake.exe" --build bld

Linux

source /opt/intel/oneapi/setvars.sh
cmake --build bld

Installing from source

The following powershell snippet will run the install target, thus installing all required binaries and resource files under the directory specified by the -DCMAKE_INSTALL_PREFIX setting

Windows

call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
"C:\Program Files\CMake\bin\cmake.exe" --build bld --target install

Linux

source /opt/intel/oneapi/setvars.sh
cmake --build bld --target install

Creating an installer

Windows

The following powershell snippet will run the package target, thus creating in the bld directory:

  • a compressed 7z archive
  • an executable MSI installer
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
"C:\Program Files\CMake\bin\cmake.exe" --build bld --target package

Linux

The following script will run the package target which will create a compressed 7z archive under the bld directory

source /opt/intel/oneapi/setvars.sh
cmake --build bld --target install

Debugging DASH in Visual Studio

Note: the 2021.4.0 version of Intel oneAPI has a bug that prevents this procedure from working correctly. Intel have fixed this with version 2022.1.0.

Instead of using the Ninja CMake Generator, you need to use the "Visual Studio 16 2019" one like this:

call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"

"C:\Program Files\CMake\bin\cmake.exe" ^
    -G "Visual Studio 16 2019" ^
    -S dash ^
    -B bld-vs ^
    -DWINTERACTER_ROOT=C:\winteracter\winteracter-14.10d ^
    -DCMAKE_Fortran_COMPILER="C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/intel64/ifort.exe" ^
    -DCMAKE_INSTALL_PREFIX=install

This command will generate a DASH Visual Studio solution in the directory you specify with the -B flag (bld-vs if you copy paste the snippet above).

Open the solution, run the ALL_BUILD target to compile all executables and libraries and then run the INSTALL target to generate a complete DASH distribution folder in your install directory.

Right click on the DASH target, select Properties and in the Debug pane, select (your install directory)/bin as the current working directory for DASH. This will allow DASH to find the files it requires

Not doing the above will cause DASH to fail on startup.

Debugging DASH in Visual Studio Code

These instructions will allow you to debug DASH on Linux.

Follow the instructions above but use -DCMAKE_BUILD_TYPE=Debug \ instead of -DCMAKE_BUILD_TYPE=Release \ when running CMake

Ensure you have the following extensions installed:

  • ms-vscode.cpptools
  • ms-vscode.cmake-tools
  • krvajalm.linter-gfortran

Having gfortran installed is useful for the linter-gfortran extension but not required.

First run the install target to create an install folder. You must set the working directory to the install/bin folder or you'll get an error.

Then add the following configuration to your .vscode/launch.json file.

{
    "configurations": [
        {
            "name": "Run dash",
            "type": "cppdbg",
            "request": "launch",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}/install/bin",
            "environment": [],
            "linux": {
                "program": "${workspaceFolder}/bld/bin/DASH",
                "externalConsole": false,
                "MIMode": "gdb",
                "miDebuggerPath": "${workspaceFolder}/dash/.devcontainer/gdb-oneapi",
                "setupCommands": [
                    {
                        "description": "Enable pretty-printing for gdb",
                        "text": "-enable-pretty-printing",
                        "ignoreFailures": true
                    },
                    {
                        "description": "Disable target async",
                        "text": "set target-async off",
                        "ignoreFailures": true
                    }
                ]
            }
        }
    ]
}