forked from hafs-community/HAFS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding hafs_datool and hafs_vi to CMake based build
- Loading branch information
1 parent
ce20bb8
commit f5821a8
Showing
12 changed files
with
474 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# (C) Copyright 2011- ECMWF. | ||
# | ||
# This software is licensed under the terms of the Apache Licence Version 2.0 | ||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
# In applying this licence, ECMWF does not waive the privileges and immunities | ||
# granted to it by virtue of its status as an intergovernmental organisation | ||
# nor does it submit to any jurisdiction. | ||
|
||
# - Try to find MKL | ||
# Once done this will define | ||
# | ||
# MKL_FOUND - system has Intel MKL | ||
# MKL_INCLUDE_DIRS - the MKL include directories | ||
# MKL_LIBRARIES - link these to use MKL | ||
# | ||
# The following paths will be searched with priority if set in CMake or env | ||
# | ||
# MKLROOT - root directory of the MKL installation | ||
# MKL_PATH - root directory of the MKL installation | ||
# MKL_ROOT - root directory of the MKL installation | ||
|
||
option( MKL_PARALLEL "if mkl shoudl be parallel" OFF ) | ||
|
||
if( MKL_PARALLEL ) | ||
|
||
set( __mkl_lib_par MKL_LIB_INTEL_THREAD ) | ||
set( __mkl_lib_name mkl_intel_thread ) | ||
|
||
find_package(Threads) | ||
|
||
else() | ||
|
||
set( __mkl_lib_par MKL_LIB_SEQUENTIAL ) | ||
set( __mkl_lib_name mkl_sequential ) | ||
|
||
endif() | ||
|
||
# Search with priority for MKLROOT, MKL_PATH and MKL_ROOT if set in CMake or env | ||
find_path(MKL_INCLUDE_DIR mkl.h | ||
PATHS ${MKLROOT} ${MKL_PATH} ${MKL_ROOT} ENV MKLROOT ENV MKL_PATH ENV MKL_ROOT | ||
PATH_SUFFIXES include NO_DEFAULT_PATH) | ||
find_path(MKL_INCLUDE_DIR mkl.h | ||
PATH_SUFFIXES include) | ||
|
||
if( MKL_INCLUDE_DIR ) # use include dir to find libs | ||
|
||
set( MKL_INCLUDE_DIRS ${MKL_INCLUDE_DIR} ) | ||
|
||
if( CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" ) | ||
get_filename_component( MKL_LIB_PATH ${MKL_INCLUDE_DIR}/../lib/intel64 ABSOLUTE ) | ||
set( __libsfx _lp64 ) | ||
else() | ||
get_filename_component( MKL_LIB_PATH ${MKL_INCLUDE_DIR}/../lib/ia32 ABSOLUTE ) | ||
set( __libsfx "" ) | ||
endif() | ||
|
||
find_library( MKL_LIB_INTEL NAMES mkl_intel${__libsfx} PATHS ${MKL_LIB_PATH} ) | ||
find_library( ${__mkl_lib_par} NAMES ${__mkl_lib_name} PATHS ${MKL_LIB_PATH} ) | ||
find_library( MKL_LIB_CORE NAMES mkl_core PATHS ${MKL_LIB_PATH} ) | ||
|
||
if( MKL_PARALLEL ) | ||
find_library( MKL_LIB_IOMP5 NAMES iomp5 PATHS ${MKL_LIB_PATH} ) | ||
endif() | ||
|
||
if( MKL_LIB_INTEL AND ${__mkl_lib_par} AND MKL_LIB_CORE ) | ||
set( MKL_LIBRARIES ${MKL_LIB_INTEL} ${${__mkl_lib_par}} ${MKL_LIB_CORE} ${MKL_LIB_IOMP5} ${CMAKE_THREAD_LIBS_INIT} ) | ||
endif() | ||
|
||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
|
||
find_package_handle_standard_args( MKL DEFAULT_MSG | ||
MKL_LIBRARIES MKL_INCLUDE_DIRS ) | ||
|
||
mark_as_advanced( MKL_INCLUDE_DIR MKL_LIB_LAPACK MKL_LIB_INTEL MKL_LIB_SEQUENTIAL MKL_LIB_CORE ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#======================================================================= | ||
#$$$ CMAKEFILE DOCUMENTATION BLOCK | ||
# Biju Thomas | ||
# Email: [email protected] | ||
#======================================================================= | ||
|
||
cmake_minimum_required(VERSION 3.15) | ||
project( | ||
DATOOL | ||
LANGUAGES C Fortran) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/") | ||
|
||
if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|GNU)$") | ||
message(WARNING "Compiler not officially supported: ${CMAKE_Fortran_COMPILER_ID}") | ||
endif() | ||
|
||
if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Intel|GNU)$") | ||
message(WARNING "Compiler not officially supported: ${CMAKE_C_COMPILER_ID}") | ||
endif() | ||
|
||
find_package(NetCDF REQUIRED C Fortran) | ||
find_package(MPI REQUIRED) | ||
|
||
set(fortran_srcs | ||
module_mpi.f90 | ||
module_structure.f90 | ||
sub_tcinfo.f90 | ||
sub_netcdf.f90 | ||
sub_tools.f90 | ||
sub_grids.f90 | ||
sub_wind_process.f90 | ||
sub_hafs_remap.f90 | ||
sub_hafsvi_proc.f90 | ||
hafs_datool.f90) | ||
|
||
set(exe_name hafs_datool.x) | ||
set(exec_dir ${CMAKE_CURRENT_SOURCE_DIR}/../../exec) | ||
|
||
add_executable(${exe_name} ${fortran_srcs}) | ||
|
||
target_compile_options(${exe_name} PRIVATE | ||
$<$<STREQUAL:${BUILD_TYPE},DEBUG>:-g> $<$<STREQUAL:${BUILD_TYPE},RELEASE>:-O3> | ||
-traceback -fp-model precise -assume byterecl -convert big_endian) | ||
|
||
target_link_options(${exe_name} PRIVATE | ||
$<$<STREQUAL:${BUILD_TYPE},DEBUG>:-g> $<$<STREQUAL:${BUILD_TYPE},RELEASE>:-O3> | ||
-traceback -fp-model precise -assume byterecl -convert big_endian) | ||
|
||
target_link_libraries( | ||
${exe_name} PRIVATE | ||
NetCDF::NetCDF_Fortran | ||
NetCDF::NetCDF_C | ||
MPI::MPI_Fortran) | ||
|
||
install(TARGETS ${exe_name} DESTINATION ${exec_dir}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#======================================================================= | ||
#$$$ CMAKEFILE DOCUMENTATION BLOCK | ||
# Biju Thomas | ||
# Email: [email protected] | ||
#======================================================================= | ||
|
||
cmake_minimum_required(VERSION 3.15) | ||
project( | ||
HAFS_VI | ||
LANGUAGES C Fortran) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/") | ||
|
||
message(CMAKE_MODULE_PATH " ${CMAKE_MODULE_PATH}") | ||
if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|GNU)$") | ||
message(WARNING "Compiler not officially supported: ${CMAKE_Fortran_COMPILER_ID}") | ||
endif() | ||
|
||
if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Intel|GNU)$") | ||
message(WARNING "Compiler not officially supported: ${CMAKE_C_COMPILER_ID}") | ||
endif() | ||
|
||
|
||
#find_package(NetCDF REQUIRED C Fortran) | ||
#find_package(MPI REQUIRED) | ||
find_package(OpenMP REQUIRED) | ||
find_package(MKL REQUIRED) | ||
|
||
add_subdirectory(create_trak_guess) | ||
add_subdirectory(create_trak_init) | ||
add_subdirectory(split) | ||
add_subdirectory(anl_pert) | ||
add_subdirectory(anl_combine) | ||
add_subdirectory(anl_enhance) | ||
add_subdirectory(anl_bogus) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#======================================================================= | ||
#$$$ CMAKEFILE DOCUMENTATION BLOCK | ||
# Biju Thomas | ||
# Email: [email protected] | ||
#======================================================================= | ||
|
||
|
||
set(fortran_srcs | ||
anl_bogus.f90 | ||
convert_axi_xy.f90 | ||
correct_mat_2.f90 | ||
interp_coef_agrid.f90) | ||
|
||
set(exe_name hafs_vi_anl_bogus.x) | ||
set(exec_dir ${CMAKE_CURRENT_SOURCE_DIR}/../../../exec) | ||
|
||
add_executable(${exe_name} ${fortran_srcs}) | ||
|
||
target_compile_options(${exe_name} PRIVATE | ||
$<$<STREQUAL:${BUILD_TYPE},DEBUG>:-g -check all> $<$<STREQUAL:${BUILD_TYPE},RELEASE>:-O3> | ||
-traceback -fp-model precise -assume byterecl -convert big_endian) | ||
|
||
target_link_options(${exe_name} PRIVATE | ||
$<$<STREQUAL:${BUILD_TYPE},DEBUG>:-g -check all> $<$<STREQUAL:${BUILD_TYPE},RELEASE>:-O3> | ||
-traceback -fp-model precise -assume byterecl -convert big_endian) | ||
|
||
install(TARGETS ${exe_name} DESTINATION ${exec_dir}) |
32 changes: 32 additions & 0 deletions
32
sorc/hafs_tools.fd/sorc/hafs_vi/anl_combine/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#======================================================================= | ||
#$$$ CMAKEFILE DOCUMENTATION BLOCK | ||
# Biju Thomas | ||
# Email: [email protected] | ||
#======================================================================= | ||
|
||
|
||
set(fortran_srcs | ||
anl_combine.f90 | ||
split_sym_asy.f90 | ||
correct_mat.f90 | ||
interp_coef_agrid.f90 | ||
fill_nmm_gridg.f90) | ||
|
||
set(exe_name hafs_vi_anl_combine.x) | ||
set(exec_dir ${CMAKE_CURRENT_SOURCE_DIR}/../../../exec) | ||
|
||
add_executable(${exe_name} ${fortran_srcs}) | ||
|
||
target_compile_options(${exe_name} PRIVATE | ||
$<$<STREQUAL:${BUILD_TYPE},DEBUG>:-g -check all> $<$<STREQUAL:${BUILD_TYPE},RELEASE>:-O3> | ||
-traceback -fp-model precise -assume byterecl -convert big_endian) | ||
|
||
target_link_options(${exe_name} PRIVATE | ||
$<$<STREQUAL:${BUILD_TYPE},DEBUG>:-g -check all> $<$<STREQUAL:${BUILD_TYPE},RELEASE>:-O3> | ||
-traceback -fp-model precise -assume byterecl -convert big_endian) | ||
|
||
target_link_libraries( | ||
${exe_name} PRIVATE | ||
OpenMP::OpenMP_Fortran) | ||
|
||
install(TARGETS ${exe_name} DESTINATION ${exec_dir}) |
Oops, something went wrong.