diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d0585943576ea5dd6234323b933f35b37da4602..b96132639769765021233461ca822da2f2a4568a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1105,6 +1105,13 @@ if (WALBERLA_BUILD_WITH_CUDA AND (CMAKE_CUDA_COMPILER_VERSION VERSION_LESS "11.0 set(CMAKE_CUDA_STANDARD 14) set(WALBERLA_USE_STD_EXPERIMENTAL_ANY 1) endif() + +# Can be used in CMake files containing generated files where the file suffix is dependent on the target +if (CUDA_FOUND) + set(CODEGEN_FILE_SUFFIX "cu") +else() + set(CODEGEN_FILE_SUFFIX "cu") +endif() ############################################################################################################################ diff --git a/apps/benchmarks/FlowAroundSphereCodeGen/CMakeLists.txt b/apps/benchmarks/FlowAroundSphereCodeGen/CMakeLists.txt index 549b7fd080053a6cb198547fc5c5a2f8763a18a1..faaaf44dc20de92da16b0333a08ab26886ab9fd7 100644 --- a/apps/benchmarks/FlowAroundSphereCodeGen/CMakeLists.txt +++ b/apps/benchmarks/FlowAroundSphereCodeGen/CMakeLists.txt @@ -1,29 +1,20 @@ waLBerla_link_files_to_builddir( "*.py" ) +waLBerla_generate_target_from_python(NAME FlowAroundSphereGenerated + FILE FlowAroundSphereCodeGen.py + OUT_FILES FlowAroundSphereCodeGen_LbSweep.${CODEGEN_FILE_SUFFIX} FlowAroundSphereCodeGen_LbSweep.h + FlowAroundSphereCodeGen_MacroSetter.${CODEGEN_FILE_SUFFIX} FlowAroundSphereCodeGen_MacroSetter.h + FlowAroundSphereCodeGen_UBB.${CODEGEN_FILE_SUFFIX} FlowAroundSphereCodeGen_UBB.h + FlowAroundSphereCodeGen_NoSlip.${CODEGEN_FILE_SUFFIX} FlowAroundSphereCodeGen_NoSlip.h + FlowAroundSphereCodeGen_Outflow.${CODEGEN_FILE_SUFFIX} FlowAroundSphereCodeGen_Outflow.h + FlowAroundSphereCodeGen_PackInfoEven.${CODEGEN_FILE_SUFFIX} FlowAroundSphereCodeGen_PackInfoEven.h + FlowAroundSphereCodeGen_PackInfoOdd.${CODEGEN_FILE_SUFFIX} FlowAroundSphereCodeGen_PackInfoOdd.h + FlowAroundSphereCodeGen_InfoHeader.h) + if (WALBERLA_BUILD_WITH_CUDA) - waLBerla_generate_target_from_python(NAME FlowAroundSphereGenerated - FILE FlowAroundSphereCodeGen.py - OUT_FILES FlowAroundSphereCodeGen_LbSweep.cu FlowAroundSphereCodeGen_LbSweep.h - FlowAroundSphereCodeGen_MacroSetter.cu FlowAroundSphereCodeGen_MacroSetter.h - FlowAroundSphereCodeGen_UBB.cu FlowAroundSphereCodeGen_UBB.h - FlowAroundSphereCodeGen_NoSlip.cu FlowAroundSphereCodeGen_NoSlip.h - FlowAroundSphereCodeGen_Outflow.cu FlowAroundSphereCodeGen_Outflow.h - FlowAroundSphereCodeGen_PackInfoEven.cu FlowAroundSphereCodeGen_PackInfoEven.h - FlowAroundSphereCodeGen_PackInfoOdd.cu FlowAroundSphereCodeGen_PackInfoOdd.h - FlowAroundSphereCodeGen_InfoHeader.h) waLBerla_add_executable( NAME FlowAroundSphereCodeGen FILE FlowAroundSphereCodeGen.cpp - DEPENDS blockforest boundary core domain_decomposition field geometry python_coupling timeloop vtk FlowAroundSphereGenerated) + DEPENDS blockforest boundary core cuda domain_decomposition field geometry python_coupling timeloop vtk FlowAroundSphereGenerated) else () - waLBerla_generate_target_from_python(NAME FlowAroundSphereGenerated - FILE FlowAroundSphereCodeGen.py - OUT_FILES FlowAroundSphereCodeGen_LbSweep.cpp FlowAroundSphereCodeGen_LbSweep.h - FlowAroundSphereCodeGen_MacroSetter.cpp FlowAroundSphereCodeGen_MacroSetter.h - FlowAroundSphereCodeGen_UBB.cpp FlowAroundSphereCodeGen_UBB.h - FlowAroundSphereCodeGen_NoSlip.cpp FlowAroundSphereCodeGen_NoSlip.h - FlowAroundSphereCodeGen_Outflow.cpp FlowAroundSphereCodeGen_Outflow.h - FlowAroundSphereCodeGen_PackInfoEven.cpp FlowAroundSphereCodeGen_PackInfoEven.h - FlowAroundSphereCodeGen_PackInfoOdd.cpp FlowAroundSphereCodeGen_PackInfoOdd.h - FlowAroundSphereCodeGen_InfoHeader.h) waLBerla_add_executable( NAME FlowAroundSphereCodeGen FILE FlowAroundSphereCodeGen.cpp DEPENDS blockforest boundary core domain_decomposition field geometry python_coupling timeloop vtk FlowAroundSphereGenerated) -endif() \ No newline at end of file +endif (WALBERLA_BUILD_WITH_CUDA) \ No newline at end of file diff --git a/apps/benchmarks/PhaseFieldAllenCahn/CMakeLists.txt b/apps/benchmarks/PhaseFieldAllenCahn/CMakeLists.txt index 35bf3f763256cd59bf0e516467e789db35a398de..139d05a24062f4093db8b2590ce597ff688917cb 100644 --- a/apps/benchmarks/PhaseFieldAllenCahn/CMakeLists.txt +++ b/apps/benchmarks/PhaseFieldAllenCahn/CMakeLists.txt @@ -1,33 +1,22 @@ waLBerla_link_files_to_builddir(*.prm) waLBerla_link_files_to_builddir(*.py) -if (WALBERLA_BUILD_WITH_CUDA) - waLBerla_generate_target_from_python(NAME BenchmarkPhaseFieldCodeGenGPU - FILE multiphase_codegen.py - OUT_FILES initialize_phase_field_distributions.cu initialize_phase_field_distributions.h - initialize_velocity_based_distributions.cu initialize_velocity_based_distributions.h - phase_field_LB_step.cu phase_field_LB_step.h - hydro_LB_step.cu hydro_LB_step.h - PackInfo_phase_field_distributions.cu PackInfo_phase_field_distributions.h - PackInfo_phase_field.cu PackInfo_phase_field.h - PackInfo_velocity_based_distributions.cu PackInfo_velocity_based_distributions.h - GenDefines.h) +waLBerla_generate_target_from_python(NAME BenchmarkPhaseFieldCodeGenGPU + FILE multiphase_codegen.py + OUT_FILES initialize_phase_field_distributions.${CODEGEN_FILE_SUFFIX} initialize_phase_field_distributions.h + initialize_velocity_based_distributions.${CODEGEN_FILE_SUFFIX} initialize_velocity_based_distributions.h + phase_field_LB_step.${CODEGEN_FILE_SUFFIX} phase_field_LB_step.h + hydro_LB_step.${CODEGEN_FILE_SUFFIX} hydro_LB_step.h + PackInfo_phase_field_distributions.${CODEGEN_FILE_SUFFIX} PackInfo_phase_field_distributions.h + PackInfo_phase_field.${CODEGEN_FILE_SUFFIX} PackInfo_phase_field.h + PackInfo_velocity_based_distributions.${CODEGEN_FILE_SUFFIX} PackInfo_velocity_based_distributions.h + GenDefines.h) +if (WALBERLA_BUILD_WITH_CUDA) waLBerla_add_executable(NAME benchmark_multiphase FILES benchmark_multiphase.cpp InitializerFunctions.cpp multiphase_codegen.py DEPENDS blockforest core cuda field postprocessing python_coupling lbm geometry timeloop gui BenchmarkPhaseFieldCodeGenGPU) else () - waLBerla_generate_target_from_python(NAME BenchmarkPhaseFieldCodeGenCPU - FILE multiphase_codegen.py - OUT_FILES initialize_phase_field_distributions.cpp initialize_phase_field_distributions.h - initialize_velocity_based_distributions.cpp initialize_velocity_based_distributions.h - phase_field_LB_step.cpp phase_field_LB_step.h - hydro_LB_step.cpp hydro_LB_step.h - PackInfo_phase_field_distributions.cpp PackInfo_phase_field_distributions.h - PackInfo_phase_field.cpp PackInfo_phase_field.h - PackInfo_velocity_based_distributions.cpp PackInfo_velocity_based_distributions.h - GenDefines.h) - waLBerla_add_executable(NAME benchmark_multiphase FILES benchmark_multiphase.cpp InitializerFunctions.cpp multiphase_codegen.py DEPENDS blockforest core field postprocessing python_coupling lbm geometry timeloop gui BenchmarkPhaseFieldCodeGenCPU)