diff --git a/src/gpu/VirtualFluids_GPU/CMakeLists.txt b/src/gpu/VirtualFluids_GPU/CMakeLists.txt index d58210ba6cf31403e670989ac87cc9c556170261..d7e4a776271c5bc243a4ed663ffecd23dec5cebb 100644 --- a/src/gpu/VirtualFluids_GPU/CMakeLists.txt +++ b/src/gpu/VirtualFluids_GPU/CMakeLists.txt @@ -1,8 +1,5 @@ project(VirtualFluids_GPU LANGUAGES CUDA CXX) -find_package(CUDA REQUIRED) -include_directories("${CUDA_INCLUDE_DIRS}") - set(additional_libraries "") if(MSVC) set(additional_libraries ws2_32 Traffic) # ws_32 throws an error on Phoenix @@ -20,10 +17,13 @@ vf_add_tests() if(BUILD_VF_UNIT_TESTS) set_target_properties(VirtualFluids_GPUTests PROPERTIES CUDA_SEPARABLE_COMPILATION ON) - set_source_files_properties(Kernel/Utilities/DistributionHelperTests.cpp PROPERTIES LANGUAGE CUDA) - set_source_files_properties(DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreamsTest.cpp PROPERTIES LANGUAGE CUDA) - set_source_files_properties(Communication/ExchangeData27Test.cpp PROPERTIES LANGUAGE CUDA) - set_source_files_properties(BoundaryConditions/BoundaryConditionFactoryTest.cpp PROPERTIES LANGUAGE CUDA) target_include_directories(VirtualFluids_GPUTests PRIVATE "${VF_THIRD_DIR}/cuda_samples/") target_include_directories(VirtualFluids_GPUTests PRIVATE "${VF_ROOT_DIR}/src/gpu/GridGenerator/") + set_source_files_properties(Communication/ExchangeData27Test.cpp PROPERTIES LANGUAGE CUDA) + set_source_files_properties(Factories/BoundaryConditionFactoryTest.cpp PROPERTIES LANGUAGE CUDA) + set_source_files_properties(DataStructureInitializer/GridReaderGenerator/GridGeneratorTest.cpp PROPERTIES LANGUAGE CUDA) + set_source_files_properties(DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreamsTest.cpp PROPERTIES LANGUAGE CUDA) + set_source_files_properties(Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17Test.cpp PROPERTIES LANGUAGE CUDA) + set_source_files_properties(Kernel/Utilities/DistributionHelperTests.cpp PROPERTIES LANGUAGE CUDA) + set_source_files_properties(Parameter/ParameterTest.cpp PROPERTIES LANGUAGE CUDA) endif() diff --git a/src/gpu/VirtualFluids_GPU/Parameter/ParameterTest.cpp b/src/gpu/VirtualFluids_GPU/Parameter/ParameterTest.cpp index 6073a4d6dd2aa7ea145bee7f6e0225f90d3ec171..bed52dc97b8bde45712bca95f924a026ccb894f1 100644 --- a/src/gpu/VirtualFluids_GPU/Parameter/ParameterTest.cpp +++ b/src/gpu/VirtualFluids_GPU/Parameter/ParameterTest.cpp @@ -250,64 +250,6 @@ TEST(ParameterTest, whenCreatingParameterClassWithGridRefinement_afterCallingIni EXPECT_THAT(para->getParH(1), testing::Ne(nullptr)); } -class MockCommunicator : public vf::gpu::Communicator -{ -public: - void waitAll() override {}; - int getPID() const override - { - return 0; - }; - int getNumberOfProcess() const override - { - return 1; - }; - void exchngData(float *sbuf_t, float *rbuf_t, float *sbuf_b, float *rbuf_b, int count) override {}; - ////////////////////////////////////////////////////////////////////////// - void exchngDataGPU(real *sbuf, int count_s, real *rbuf, int count_r, int nb_rank) override {}; - void nbRecvDataGPU(real *rbuf, int count_r, int nb_rank) override {}; - void nbSendDataGPU(real *sbuf, int count_s, int nb_rank) override {}; - void waitallGPU() override {}; - void sendDataGPU(real *sbuf, int count_s, int nb_rank) override {}; - void waitGPU(int id) override {}; - void resetRequest() override {}; - ////////////////////////////////////////////////////////////////////////// - int mapCudaDevice(const int &rank, const int &size, const std::vector<unsigned int> &devices, const int &maxdev) override - { - return 0; - }; - double reduceSum(double quantityPerProcess) override - { - return 0; - }; - ////////////////////////////////////////////////////////////////////////// - void receive_send(uint *buffer_receive, int size_buffer_recv, int neighbor_rank_recv, uint *buffer_send, int size_buffer_send, int neighbor_rank_send) const override {}; - -}; - -TEST(ParameterTest, whenCreatingParameterClassWithGridRefinement_afterCallingSimulationConstructor_shouldNotThrow) -{ - spdlog::set_level(spdlog::level::warn); // avoids logger spam in output - - auto para = std::make_shared<Parameter>(); - para->setMaxLevel(2); - - SPtr<CudaMemoryManager> cudaMemoryManager = std::make_shared<CudaMemoryManager>(para); - MockCommunicator communicator = MockCommunicator(); - auto gridFactory = GridFactory::make(); - auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); - SPtr<GridProvider> gridGenerator = - std::make_shared<MockGridGenerator>(gridBuilder, para, cudaMemoryManager, communicator); - BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); - GridScalingFactory scalingFactory = GridScalingFactory(); - - EXPECT_THAT(para->getParH(1), testing::Eq(nullptr)); // Parameter initialization incomplete - // Simulation() calls para->initLBMSimulationParameter() --> that function completes the initialization of Parameter - Simulation sim(para, cudaMemoryManager, communicator, *gridGenerator, &bcFactory, &scalingFactory); - EXPECT_THAT(para->getParH(1), testing::Ne(nullptr)); - EXPECT_NO_THROW(cudaMemoryManager->cudaAllocLevelForcing(1)); // throws if para->getParH(1) is a null pointer -} - class ParameterTestCumulantK17 : public testing::Test { protected: