Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
Installation

Neko-TOP is an extension of the Neko library, and as such it requires the Neko library to be installed. The Neko library also has a number of dependencies, such as the JSON-Fortran library, which is used for reading and writing JSON files, and the PFUnit library, which is used for unit testing.

Here we provide a brief overview of the dependencies and how to compile the library. For more detailed information, please see the documentation for the individual libraries. In particular, the Neko library has a detailed documentation on how to compile and install the library, with support for various accelerators. Neko homepage.

Dependencies

We group the dependencies into two categories: system dependencies and external libraries. The system dependencies are the dependencies that are required to compile the Neko library and the Neko-TOP library. The external libraries are the libraries that are required to run the examples and the tests.

System dependencies

The system dependencies are the dependencies that are required to compile the Neko library and the Neko-TOP library. The system dependencies are:

  1. A Fortran 2008 compliant compiler
  2. CMake
  3. A C compiler
  4. A C++ compiler
  5. A MPI library
  6. A BLAS/LAPACK library
  7. Autotools
  8. PKG-Config

External libraries

The external libraries are required to be present for the compilation of Neko-TOP. However, these can be compiled and installed by the setup.sh script if they are not already present on the system. The external libraries are:

  1. Neko
  2. JSON-Fortran (Required by Neko)
  3. GSLib (Required by Neko)
  4. Nek5000 (optional)
  5. PFUnit (optional)
  6. CUDA (optional)

Quick-start compilation

To compile the library and all external dependencies, the user can run the setup.sh script. This script will download and compile all dependencies and the Neko-TOP library. The script will also compile all the advanced examples and run the unit tests if desired.

git clone https://github.com/ExtremeFlow/Neko-TOP.git neko-top
cd neko-top
./setup.sh

Setup script

The setup.sh script is an automated setup of Neko-TOP along with Neko and other dependencies. The script relies in a number of environment variables, which can be used to modify the behaviour of the system and allow the user to specify custom install locations for the given dependencies.

Variable Description Default
NEKO_DIR Location of the Neko library. external/neko
JSON_FORTRAN_DIR JSON-Fortran library, required dependency of Neko. external/json-fortran
NEK5000_DIR Nek5000, primarily used for meshing and for GSLib. external/Nek5000
PFUNIT_DIR Unit testing library used in Neko. -
CUDA_DIR Location of the CUDA library folders, needed for Nvidia GPU support. -
CUDA_ARCH CUDA architecture for GPU builds (for example 80 for sm_80). Required for CUDA
CMAKE_BUILD_TYPE Neko-TOP's build type: Debug, Testing or Release. Release (-t: Testing)
NEKO_FCFLAGS Override Fortran flags configure builds Neko with. -
NEKO_CFLAGS Override C flags configure builds Neko with. -

When Neko-TOP is configured with CMake directly rather than through setup.sh, an installation found under NEKO_DIR or JSON_FORTRAN_DIR, including their external/ defaults, takes precedence over any matching package on PKG_CONFIG_PATH. Passing -DNEKO_DIR= or -DJSON_FORTRAN_DIR= (an empty value) hands that lookup back to PKG_CONFIG_PATH. CMake caches the result of the lookup, so changing either variable in an existing build directory requires reconfiguring with cmake --fresh (CMake 3.24 or newer) or starting from an empty build directory.

CMAKE_BUILD_TYPE only selects the optimisation/debug-symbol flags (-O3 -funroll-loops for Release, -g -Og for Debug, -g -O2 for Testing, on GNU); it does not turn compiler warnings into errors. Warnings are compiled in for Debug and Testing but are not fatal unless -DCMAKE_COMPILE_WARNING_AS_ERROR=ON (CMake 3.24 or newer) is also passed, e.g. via CMAKE_VARIABLES — see the contributing guide.

NEKO_FCFLAGS/NEKO_CFLAGS only take effect while Neko is actually being configured. An already-configured Neko tree (an existing $NEKO_DIR/Makefile) is reused as-is with its existing flags; pass --clean-neko to reconfigure it with new ones. Note that --clean-neko also wipes Neko-TOP's own build/ directory.

These can be defined either on the command line by the user or in a prepare.env file which is loaded by the setup script if it exists in the root of Neko-TOP. This preparation script will also be loaded by the run.sh script, so it is possible to define environment variables for the execution of the examples as well. The prepare script provide a convenient way to use module systems such as spack or similar to activate environments and such before compilation.

An example of a prepare.env file is shown below:

#!/bin/bash
module load cuda/10.1
export CUDA_DIR=$CUDA_HOME
export CUDA_ARCH=80
export NEKO_DIR=$HOME/neko

For CUDA builds, CUDA_ARCH must be explicitly specified before running setup.sh (for example export CUDA_ARCH=80).

Additional examples of the preparation script for specific systems can be seen in the section on clusters: Cluster configurations.

Notes on linking against CUDA on WSL.

Look through the following documentations:

  1. https://learn.microsoft.com/en-us/windows/ai/directml/gpu-cuda-in-wsl
  2. https://docs.nvidia.com/cuda/wsl-user-guide/index.html#getting-started-with-cuda-on-wsl
  3. https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=WSL-Ubuntu&target_version=2.0&target_type=deb_local

Link 1 is the microsoft description of getting started with WSL 2. Link 2 is the NVidia guideline to how to correctly use WSL and CUDA together. Link 3 is the link to download instructions for CUDA toolkit and drivers to WSL. Remember to update NVidia graphics drivers on the windows side as well.