Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/inactive_workflows/fesom2_icepack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ jobs:
# Docker Hub image that `container-job` executes in
container: koldunovn/fesom2_test:refactoring2

env:
CMAKE_ARGS: -DUSE_ICEPACK=ON

# Service containers to run with `gfortran_ubuntu`
steps:
# NK: this changes working directory to fesom2
- uses: actions/checkout@v2

- name: prepeare FESOM2_icepack
run: |
sed -i 's/USE_ICEPACK OFF/USE_ICEPACK ON/g' CMakeLists.txt
cd ./src/icepack_drivers/
./download_icepack.sh
cd ../../
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/fesom2.1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@ jobs:
# NK: this changes working directory to fesom2
- uses: actions/checkout@v2

- name: Compile model (binary)
- name: Compile model
run: |
bash -l configure.sh ubuntu

- name: Compile model (library)
- name: Check library exists
run: |
bash ./test/ifs_interface/configure_lib.sh -l
./test/ifs_interface/check_exist.sh

- name: Library exists
- name: Check downstream find_package(fesom)
run: |
bash ./test/ifs_interface/check_exist.sh
cd test_downstream
cmake -S . -B build -Dfesom_ROOT=$(pwd)/..

- name: Create global test run
run: |
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/fesom2_openmp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,14 @@ jobs:
# Docker Hub image that `container-job` executes in
container: koldunovn/fesom2_test:refactoring2

env:
CMAKE_ARGS: -DENABLE_OPENMP=ON

# Service containers to run with `gfortran_ubuntu`
steps:
# NK: this changes working directory to fesom2
- uses: actions/checkout@v2

- name: switch OpenMP ON
run: |
cd ./src/
sed -i 's/with OpenMP\" OFF/with OpenMP\" ON/g' CMakeLists.txt
cd ../

- name: Compile model
run: |
bash -l configure.sh ubuntu
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ set(OPENMP_REPRODUCIBLE OFF CACHE BOOL "serialize OpenMP loops that are critical

#set(VERBOSE OFF CACHE BOOL "toggle debug output")
#add_subdirectory(oasis3-mct/lib/psmile)
add_subdirectory(src)
add_subdirectory(src fesom)
33 changes: 29 additions & 4 deletions cmake/FindNETCDF.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ if(CMAKE_Fortran_COMPILER_LOADED)
if(HAVE_Fortran_NETCDF)
set(NETCDF_Fortran_INCLUDE_DIRECTORIES "")
set(NETCDF_Fortran_LIBRARIES "")
set(NETCDF_Fortran_FOUND 1)
else()
find_path(NETCDF_Fortran_INCLUDE_DIRECTORIES netcdf.inc HINTS $ENV{NETCDF_DIR}/include ENV NETCDF_Fortran_INCLUDE_DIRECTORIES)
find_path(NETCDF_Fortran_INCLUDE_DIRECTORIES netcdf.inc HINTS $ENV{NETCDF_DIR}/include $ENV{NETCDF4_DIR}/include ENV NETCDF_Fortran_INCLUDE_DIRECTORIES)
find_library(NETCDF_Fortran_LIBRARIES netcdff HINTS ${NETCDF_Fortran_INCLUDE_DIRECTORIES}/../lib)
if( NETCDF_Fortran_INCLUDE_DIRECTORIES AND NETCDF_Fortran_LIBRARIES )
set(NETCDF_Fortran_FOUND 1)
endif()
endif()
endif()

Expand All @@ -27,14 +31,18 @@ if(CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)
if(HAVE_C_NETCDF)
set(NETCDF_C_INCLUDE_DIRECTORIES "")
set(NETCDF_C_LIBRARIES "")
set(NETCDF_C_FOUND 1)
else()
find_path(NETCDF_C_INCLUDE_DIRECTORIES netcdf.h HINTS $ENV{NETCDF_DIR}/include ENV NETCDF_C_INCLUDE_DIRECTORIES)
find_path(NETCDF_C_INCLUDE_DIRECTORIES netcdf.h HINTS $ENV{NETCDF_DIR}/include $ENV{NETCDF4_DIR}/include ENV NETCDF_C_INCLUDE_DIRECTORIES)
find_library(NETCDF_C_LIBRARIES netcdf HINTS ${NETCDF_C_INCLUDE_DIRECTORIES}/../lib)
if( NETCDF_C_INCLUDE_DIRECTORIES AND NETCDF_C_LIBRARIES )
set(NETCDF_C_FOUND 1)
endif()
endif()
endif()

if(CMAKE_CXX_COMPILER_LOADED)
find_path(NETCDF_CXX_INCLUDE_DIRECTORIES netcdf HINTS $ENV{NETCDF_DIR}/include ENV NETCDF_CXX_INCLUDE_DIRECTORIES)
find_path(NETCDF_CXX_INCLUDE_DIRECTORIES netcdf HINTS $ENV{NETCDF_DIR}/include $ENV{NETCDF4_DIR} ENV NETCDF_CXX_INCLUDE_DIRECTORIES)
# the cray toolchain (e.g. hlrn) disables dynamic linking by default. to enable it at build time do e.g. "CRAYPE_LINK_TYPE=dynamic make".
find_library(NETCDF_CXX_LIBRARIES NAMES netcdf_c++4 netcdf-cxx4 HINTS ${NETCDF_CXX_INCLUDE_DIRECTORIES}/../lib)
if(NETCDF_CXX_INCLUDE_DIRECTORIES AND NETCDF_C_INCLUDE_DIRECTORIES)
Expand All @@ -43,4 +51,21 @@ if(CMAKE_CXX_COMPILER_LOADED)
if(NETCDF_CXX_LIBRARIES AND NETCDF_C_LIBRARIES)
list(APPEND NETCDF_CXX_LIBRARIES ${NETCDF_C_LIBRARIES})
endif()
endif()
if( NETCDF_CXX_INCLUDE_DIRECTORIES AND NETCDF_CXX_LIBRARIES )
set(NETCDF_CXX_FOUND 1)
endif()
endif()

if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
set(${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS C)
endif()

unset({CMAKE_FIND_PACKAGE_NAME}_REQUIRED_VARS)
foreach(COMP C CXX Fortran)
if("${COMP}" IN_LIST ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
list(APPEND ${CMAKE_FIND_PACKAGE_NAME}_REQUIRED_VARS NETCDF_${COMP}_FOUND)
endif()
endforeach()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME} HANDLE_COMPONENTS REQUIRED_VARS ${CMAKE_FIND_PACKAGE_NAME}_REQUIRED_VARS)

6 changes: 3 additions & 3 deletions configure.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash

set -e

HERE=$PWD
source env.sh # source this from your run script too
mkdir build || true # make sure not to commit this to svn or git
mkdir -p build
cd build
cmake .. # not required when re-compiling
cmake .. -DCMAKE_INSTALL_PREFIX=$HERE ${CMAKE_ARGS}
make install -j`nproc --all`
20 changes: 13 additions & 7 deletions lib/parms/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
cmake_minimum_required(VERSION 3.4)

project(parms C)
project(fesom_parms C)

# Set location to look for find_package modules
set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../cmake )

# Set -fPIC flag etc.
set( CMAKE_POSITION_INDEPENDENT_CODE ON )

# get our source files
set(src_home ${CMAKE_CURRENT_LIST_DIR}) # path to src directory starting from the dir containing our CMakeLists.txt
file(GLOB all_sources ${src_home}/src/*.c ${src_home}/src/DDPQ/*.c)

include("${CMAKE_CURRENT_LIST_DIR}/../../cmake/FindBLAS.cmake")
find_package(BLAS)
if(NOT TARGET MPI::MPI_C)
find_package(MPI REQUIRED COMPONENTS C)
endif()

# create our library (set its name to name of this project)
add_library(${PROJECT_NAME} SHARED ${all_sources})
add_library(${PROJECT_NAME} ${all_sources})

target_compile_definitions(${PROJECT_NAME}
PRIVATE PARMS USE_MPI REAL=double DBL FORTRAN_UNDERSCORE VOID_POINTER_SIZE_8 HAS_BLAS)
Expand All @@ -18,15 +27,12 @@ target_include_directories(${PROJECT_NAME}
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PRIVATE ${src_home}/src/include
)

target_link_libraries(${PROJECT_NAME} PRIVATE ${BLAS_C_LIBRARIES} $ENV{UBUNTU_BLAS_LIBRARY})
target_link_libraries(${PROJECT_NAME} PRIVATE MPI::MPI_C)

if(${CMAKE_C_COMPILER_ID} STREQUAL "Intel")
target_compile_options(${PROJECT_NAME} PRIVATE -no-prec-div -no-prec-sqrt -fast-transcendentals -fp-model precise)
if(${FESOM_PLATFORM_STRATEGY} STREQUAL levante.dkrz.de )
target_compile_options(${PROJECT_NAME} PRIVATE -march=core-avx2 -mtune=core-avx2)
endif()
endif()

target_compile_options(${PROJECT_NAME} PRIVATE -fPIC)
install(TARGETS ${PROJECT_NAME} EXPORT ifs_sp-targets DESTINATION "${FESOM_INSTALL_PREFIX}/lib")
5 changes: 5 additions & 0 deletions lib/parms/src/parms_pc_schurras.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
#endif
#endif

/* Forward declarations */
int parms_OperatorGetU(parms_Operator self, void **mat);
int parms_MatGetOffDiag(parms_Mat self, void **mat);
int parms_CommGetOdvlist(parms_Comm self, int **odvlist);

typedef struct schurras_data {

parms_Operator op_out,op_in;
Expand Down
Loading