Skip to content

Commit

Permalink
Link and run tests with transi_gpu_dp
Browse files Browse the repository at this point in the history
  • Loading branch information
wdeconinck committed Dec 19, 2024
1 parent 47b31e7 commit bfc54b2
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 19 deletions.
39 changes: 26 additions & 13 deletions cmake/features/ECTRANS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,42 @@ if( DEFINED ATLAS_ENABLE_ECTRANS )
set( ENABLE_ECTRANS ${ATLAS_ENABLE_ECTRANS} )
endif()

macro( make_transi_alias target )
if( NOT TARGET transi )
if( CMAKE_VERSION VERSION_LESS 3.18 )
# Before CMake 3.18 it is not possible to alias a non-global imported target
# Make the import global. Warning, this may break further find_package
get_target_property( ${target}_IMPORTED ${target} IMPORTED )
if( transi_dp_IMPORTED )
set_target_properties( ${target} PROPERTIES IMPORTED_GLOBAL TRUE)
endif()
endif()
add_library( transi ALIAS ${target} )
endif()
endmacro()

set( atlas_HAVE_PACKAGE_ECTRANS 0 )
if( atlas_HAVE_ATLAS_FUNCTIONSPACE AND (ENABLE_ECTRANS OR NOT DEFINED ENABLE_ECTRANS) )
find_package( ectrans 1.1 COMPONENTS transi double QUIET )
if( TARGET transi_dp )
if( TARGET transi_dp OR TARGET transi_gpu_dp )
set( transi_FOUND TRUE )
if( NOT TARGET transi )
if( CMAKE_VERSION VERSION_LESS 3.18 )
# Before CMake 3.18 it is not possible to alias a non-global imported target
# Make the import global. Warning, this may break further find_package
get_target_property( transi_dp_IMPORTED transi_dp IMPORTED )
if( transi_dp_IMPORTED )
set_target_properties( transi_dp PROPERTIES IMPORTED_GLOBAL TRUE)
endif()
endif()
add_library( transi ALIAS transi_dp )
endif()
set( atlas_HAVE_PACKAGE_ECTRANS 1 )
else()
find_package( transi 0.8 QUIET )
endif()
endif()
ecbuild_add_option( FEATURE ECTRANS
DESCRIPTION "Support for IFS spectral transforms"
DESCRIPTION "Support for ectrans spectral transforms"
CONDITION atlas_HAVE_ATLAS_FUNCTIONSPACE AND transi_FOUND )
ecbuild_add_option( FEATURE ECTRANS_GPU DEFAULT OFF
DESCRIPTION "Support for ectrans spectral transforms"
CONDITION HAVE_ECTRANS AND TARGET transi_gpu_dp )
if( HAVE_ECTRANS_GPU AND TARGET transi_gpu_dp)
ecbuild_warn("ectrans GPU version")
make_transi_alias( transi_gpu_dp )
elseif( HAVE_ECTRANS AND TARGET transi_dp )
ecbuild_warn("ectrans CPU version")
make_transi_alias( transi_dp )
endif()

endif()
4 changes: 2 additions & 2 deletions src/tests/functionspace/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if( HAVE_FCTEST )
LINKER_LANGUAGE Fortran
SOURCES fctest_functionspace.F90
LIBS atlas_f
ENVIRONMENT ${ATLAS_TEST_ENVIRONMENT}
ENVIRONMENT ${ATLAS_TEST_ENVIRONMENT} ATLAS_FINALISES_MPI=1
)

add_fctest( TARGET atlas_fctest_blockstructuredcolumns
Expand All @@ -28,7 +28,7 @@ if( HAVE_FCTEST )
LINKER_LANGUAGE Fortran
SOURCES fctest_blockstructuredcolumns.F90
LIBS atlas_f
ENVIRONMENT ${ATLAS_TEST_ENVIRONMENT}
ENVIRONMENT ${ATLAS_TEST_ENVIRONMENT} ATLAS_FINALISES_MPI=1
)

endif()
Expand Down
2 changes: 1 addition & 1 deletion src/tests/redistribution/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if( HAVE_FORTRAN )
LINKER_LANGUAGE Fortran
SOURCES fctest_redistribution.F90
LIBS atlas_f
ENVIRONMENT ${ATLAS_TEST_ENVIRONMENT}
ENVIRONMENT ${ATLAS_TEST_ENVIRONMENT} ATLAS_FINALISES_MPI=1
)
endif()

Expand Down
4 changes: 2 additions & 2 deletions src/tests/trans/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if( HAVE_FCTEST )
LIBS atlas_f
CONDITION eckit_HAVE_MPI AND ( transi_HAVE_MPI OR ectrans_HAVE_MPI )
MPI 4
ENVIRONMENT ${ATLAS_TEST_ENVIRONMENT}
ENVIRONMENT ${ATLAS_TEST_ENVIRONMENT} ATLAS_FINALISES_MPI=1
)
endif()

Expand All @@ -25,7 +25,7 @@ if( HAVE_FCTEST )
LINKER_LANGUAGE Fortran
SOURCES fctest_trans_invtrans_grad.F90
LIBS atlas_f
ENVIRONMENT ${ATLAS_TEST_ENVIRONMENT}
ENVIRONMENT ${ATLAS_TEST_ENVIRONMENT} ATLAS_FINALISES_MPI=1
)
endif()

Expand Down
6 changes: 6 additions & 0 deletions src/tests/trans/test_trans.cc
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,8 @@ CASE("test_trans_using_functionspace_StructuredColumns") {
EXPECT_THROWS_AS(trans.dirtrans(gpfields, spfields), eckit::Exception);
}

#if 0
// NOT SUPPORTED IN ECTRANS WITH GPU
CASE("test_trans_MIR_lonlat") {
Log::info() << "test_trans_MIR_lonlat" << std::endl;

Expand All @@ -532,7 +534,10 @@ CASE("test_trans_MIR_lonlat") {
EXPECT_NO_THROW(trans.dirtrans(1, gpf.data(), spf.data(), option::global()));
}
}
#endif

#if 0
// NOT SUPPORTED IN ECTRANS WITH GPU
CASE("test_trans_VorDivToUV") {
int nfld = 1; // TODO: test for nfld>1
std::vector<int> truncation_array{1}; // truncation_array{159,160,1279};
Expand Down Expand Up @@ -592,6 +597,7 @@ CASE("test_trans_VorDivToUV") {
}
}
}
#endif

#ifdef TRANS_HAVE_IO
CASE("ATLAS-256: Legendre coefficient expected unique identifiers") {
Expand Down
4 changes: 3 additions & 1 deletion src/tests/trans/test_transgeneral.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,8 @@ CASE("test_trans_levels") {
}
#endif


#if 0
// ECTRANS GPU VERSION DOES NOT YET SUPPORT THIS
#if ATLAS_HAVE_TRANS
#if ATLAS_HAVE_ECTRANS || defined(TRANS_HAVE_INVTRANS_ADJ)
CASE("test_2level_adjoint_test_with_powerspectrum_convolution") {
Expand Down Expand Up @@ -1814,6 +1815,7 @@ CASE("test_2level_adjoint_test_with_vortdiv") {
}
#endif
#endif
#endif

#if 0
CASE( "test_trans_fourier_truncation" ) {
Expand Down

0 comments on commit bfc54b2

Please sign in to comment.