Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emancipation from serialbox via HDF5 for C-style variants #62

Merged
merged 4 commits into from
Feb 9, 2024
Merged
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
7 changes: 1 addition & 6 deletions .github/scripts/verify-targets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ exit_code=0
# Build the list of targets
#

targets=(dwarf-P-cloudMicrophysics-IFSScheme dwarf-cloudsc-fortran)

if [[ "$io_library_flag" == "--with-serialbox" ]]
then
targets+=(dwarf-cloudsc-c)
fi
targets=(dwarf-P-cloudMicrophysics-IFSScheme dwarf-cloudsc-fortran dwarf-cloudsc-c)

if [[ "$build_flags" == *"--with-gpu"* ]]
then
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ endif()
### HDF5
ecbuild_add_option( FEATURE HDF5
DESCRIPTION "Use HDF5 to read input and reference data"
REQUIRED_PACKAGES "HDF5 COMPONENTS Fortran"
REQUIRED_PACKAGES "HDF5 COMPONENTS Fortran C"
DEFAULT ON )
if( HAVE_HDF5 )
list(APPEND CLOUDSC_DEFINITIONS HAVE_HDF5 )
Expand Down
26 changes: 20 additions & 6 deletions src/cloudsc_c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Define this dwarf variant as an ECBuild feature
ecbuild_add_option( FEATURE CLOUDSC_C
DESCRIPTION "Build the C version CLOUDSC using Serialbox" DEFAULT ON
CONDITION Serialbox_FOUND
CONDITION Serialbox_FOUND OR HDF5_FOUND
)

if( HAVE_CLOUDSC_C )
Expand Down Expand Up @@ -37,12 +37,15 @@ if( HAVE_CLOUDSC_C )
cloudsc/cloudsc_validate.c
cloudsc/mycpu.h
cloudsc/mycpu.c
PUBLIC_INCLUDES
PUBLIC_INCLUDES
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cloudsc>
PUBLIC_LIBS
Serialbox::Serialbox_C
$<${HAVE_OMP}:OpenMP::OpenMP_C>
$<${HAVE_HDF5}:hdf5::hdf5>
$<${HAVE_SERIALBOX}:Serialbox::Serialbox_C>
$<${HAVE_OMP}:OpenMP::OpenMP_C>
DEFINITIONS
${CLOUDSC_DEFINITIONS}
)

ecbuild_add_executable(
Expand Down Expand Up @@ -74,6 +77,17 @@ if( HAVE_CLOUDSC_C )
CONDITION HAVE_OMP
)

else()
ecbuild_info( "Serialbox not found, disabling C prototype" )
endif()

# Create symlink for the input data
if( HAVE_SERIALBOX )
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
${CMAKE_CURRENT_SOURCE_DIR}/../../data ${CMAKE_CURRENT_BINARY_DIR}/../../../data )
endif()

if( HAVE_HDF5 )
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
${CMAKE_CURRENT_SOURCE_DIR}/../../config-files/input.h5 ${CMAKE_CURRENT_BINARY_DIR}/../../../input.h5 )
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
${CMAKE_CURRENT_SOURCE_DIR}/../../config-files/reference.h5 ${CMAKE_CURRENT_BINARY_DIR}/../../../reference.h5 )
endif()
2 changes: 1 addition & 1 deletion src/cloudsc_c/cloudsc/cloudsc_validate.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void validate_3d(const char *name, double *v_ref, double *v_field, int nlon,
}


int cloudsc_validate(const int nlon, const int nlev, const int nclv, const int ngptot, const int nproma,
void cloudsc_validate(const int nlon, const int nlev, const int nclv, const int ngptot, const int nproma,
double *plude, double *pcovptot, double *prainfrac_toprfz, double *pfsqlf, double *pfsqif,
double *pfcqlng, double *pfcqnng, double *pfsqrf, double *pfsqsf, double *pfcqrng, double *pfcqsng,
double *pfsqltur, double *pfsqitur, double *pfplsl, double *pfplsn, double *pfhpsl, double *pfhpsn,
Expand Down
2 changes: 1 addition & 1 deletion src/cloudsc_c/cloudsc/cloudsc_validate.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include "load_state.h"

int cloudsc_validate(const int nlon, const int nlev, const int nclv, const int ngptot, const int nproma,
void cloudsc_validate(const int nlon, const int nlev, const int nclv, const int ngptot, const int nproma,
double *plude, double *pcovptot, double *prainfrac_toprfz, double *pfsqlf, double *pfsqif,
double *pfcqlng, double *pfcqnng, double *pfsqrf, double *pfsqsf, double *pfcqrng, double *pfcqsng,
double *pfsqltur, double *pfsqitur, double *pfplsl, double *pfplsn, double *pfhpsl, double *pfhpsn,
Expand Down
Loading
Loading