Using GitHub Actions cache is a little more complicated than not caching, but makes the setup time dramatically shorter.
This example uses MKL and MPI.
Live example with Fortran only (no MKL or MPI).
cmake_minimum_required(VERSION 3.19) | |
project(link LANGUAGES CXX Fortran) | |
file(GENERATE OUTPUT lib.cpp CONTENT "extern \"C\" int addtwo(int N){ return N + 2; }") | |
file(GENERATE OUTPUT main.f90 CONTENT "program adder | |
use, intrinsic :: iso_c_binding, only : C_INT |
cmake_minimum_required(VERSION 3.10...3.28) | |
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) | |
message(FATAL_ERROR "In-source builds are not allowed. | |
cmake -Bbuild") | |
endif() | |
project(fs_unc LANGUAGES CXX) | |
enable_testing() |
Using GitHub Actions cache is a little more complicated than not caching, but makes the setup time dramatically shorter.
This example uses MKL and MPI.
Live example with Fortran only (no MKL or MPI).
source /opt/intel/oneapi/setvars.sh | |
export CC=icx CXX=icpx FC=ifx | |
export MPI_ROOT=$I_MPI_ROOT |
# when wanting to use NVIDIA HPC SDK, type in Terminal | |
# source ~/nvidia-hpc.sh | |
nvroot=/opt/nvidia/hpc_sdk/Linux_x86_64/2023/ | |
cudaroot=${nvroot}/cuda/ | |
export PATH=$PATH:${cudaroot}/bin/:${nvroot}/compilers/bin/ | |
export CC=nvc CXX=nvc++ FC=nvfortran |
This example is for BU SCC, but other HPC work similarly.
A couple of the source files take several minutes each to compile--whole build takes about 20 minutes.
NOTE: if you previously loaded other modules, best to logoff and logon to have a known fresh environment.
/* example of VTK HDF5 file format | |
This is a de facto HDF5 file template using specific group names and dataset hierarchy. | |
ParaView can also read these VTK HDF5 files. | |
Build: use the HDF5 compiler wrapper for convenience: | |
h5cc vtk_write.c -o vtk_demo | |
./vtk_demo hi.h5 |
cmake_minimum_required(VERSION 3.10) | |
project(LotOfModules LANGUAGES Fortran) | |
message(STATUS "CMake ${CMAKE_VERSION}") | |
add_library(m1 OBJECT m1.f90) | |
add_library(m2 OBJECT m2.f90) | |
target_link_libraries(m2 PRIVATE m1) |
cmake_minimum_required(VERSION 3.23) | |
set(CMAKE_FIND_DEBUG_MODE true) | |
# in my opinion, I shouldn't need to set CMAKE_IGNORE_PATH as well. | |
if(DEFINED ENV{CONDA_PREFIX}) | |
list(APPEND CMAKE_IGNORE_PREFIX_PATH $ENV{CONDA_PREFIX}) | |
list(APPEND CMAKE_IGNORE_PATH $ENV{CONDA_PREFIX}/bin) | |
endif() |