# Installing MASS CUDA

## Pre Requirements

* gcc/clang toolchain with C++ 17 support
* cmake 3.20+
* CUDA 12+
* NCCL v2.29.7-1 or higher
* libssh 0.11.4+
* git

If you are not sure how to install NCCL and libssh, consider using the script provided in the repository of MASS CUDA, which is under the `dependencies_install_scripts` directory. 


## Add as dependency in CMake with FetchContent (Recomended)

In `CMakeLists.txt`, the MASS CUDA can be access using FetchContent.

```cmake
include(FetchContent)

set(MASS_CUDA_REPO_URL "https://bitbucket.org/mass_library_developers/mass_cuda_core")
set(MASS_CUDA_VERSION "develop")    # git tag or branch name here

FetchContent_Declare(
    mass_cuda
    GIT_REPOSITORY ${MASS_CUDA_REPO_URL}
    GIT_TAG ${MASS_CUDA_VERSION}
)
FetchContent_MakeAvailable(mass_cuda)
```

To add it as a dependency to your executable target, use `target_link_libraries`

```cmake
target_link_libraries(your_target 
    PRIVATE 
        mass_cuda
        # other dependencies
)
```


## Prebuild and install into certain path

MASS CUDA can also be built from source and installed into specified directory

```sh
git clone https://bitbucket.org/mass_library_developers/mass_cuda_core -b [version]
cd mass_cuda_core
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=[path_to_installation_dir]
cmake --build build --parallel 
cmake --install build 
```

```{note}
Currently some project related configurations (e.g.: MASS_MAX_NEIGHBOR) can only be set at compile-time and cannot be modified after that. So, prebuild the library is not currently recommended since the configuration may not be suitable for all simulations
```