cmake_minimum_required(VERSION 3.10)

project(parallelisationDemonstration
  LANGUAGES CXX
  VERSION 1.0.0
  DESCRIPTION "A project to demonstrate parallelisation in C++"
)

# --- Sequential code ---
add_executable(heat1Dsequential "src/heat1Dsequential.cpp")

# --- OpenMP code ---
add_executable(heat1DOpenMP "src/heat1DOpenMP.cpp")
find_package(OpenMP REQUIRED)
target_link_libraries(heat1DOpenMP PRIVATE OpenMP::OpenMP_CXX)

# --- MPI ---
add_executable(heat1DMPIV2 "src/heat1DMPI.cpp")
find_package(MPI REQUIRED)
target_link_libraries(heat1DMPIV2 PRIVATE MPI::MPI_CXX)

# --- CUDA code ---
enable_language(CUDA)
# the CUDA_ARCHITECTURE sets the compute capability of your GPU
# To figure out your compute capability, use the following steps:
#   1. Run nvidia-smi in your terminal/power-shell
#   2. Note down your GPU (e.g. NVIDIA RTX A2000)
#   3. Check your compute capability for your GPU here: https://developer.nvidia.com/cuda-gpus
#   4. Enter your compute capability here, removing the dot.
#      For example, a compute capability of 8.6 becomes 86, 10.3 becomes 103, etc.
set(CMAKE_CUDA_ARCHITECTURES 86)
add_executable(heat1DCUDA "src/heat1DCUDA.cpp" "src/heat1DCUDA.cu")
find_package(CUDAToolkit REQUIRED)
target_link_libraries(heat1DCUDA PRIVATE CUDA::cudart)