diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b84d22038b3159fd5aedb951fb48c35b99babe94..372c04ae40069c25b5a0c960fb5ea37ebeb7c0e1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -99,7 +99,7 @@ gcc_9_rebuild: ############################################################################### -gcc_9_cpu_warning_like_errors: +gcc_9_warning_like_errors: stage: build image: irmb/virtualfluids-deps-ubuntu20.04 @@ -118,7 +118,8 @@ gcc_9_cpu_warning_like_errors: - cd $CI_PROJECT_DIR/build - rm -r -f ./* - cmake .. - --preset=cpu_make_ccache + --preset=all_make_ccache + -DCMAKE_CUDA_ARCHITECTURES=60 -DBUILD_WARNINGS_AS_ERRORS=ON - make -j4 - ccache -s diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4bf538b84b0211ada593913a556f10be0d6ed608..a0693d564438ece97e0e9bebc7262bf189a337d4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,12 +1,12 @@ # Contributing If you want to contribute to VirtualFluids, your help is very welcome. -To contribute use a pull request as follows: +To contribute use a merge request as follows: -### How to make a clean pull request +### How to make a clean merge request - Create a personal fork of VirtualFluids. -- Clone the fork on your local machine. Your remote repo on gitea is called `origin`. +- Clone the fork on your local machine. Your remote repo on gitlab is called `origin`. - Add the original repository as a remote called `upstream`. - If you created your fork a while ago be sure to pull upstream changes into your local repository. - Create a new branch to work on! Branch from `develop` or `open_source`. @@ -16,10 +16,10 @@ To contribute use a pull request as follows: - Write or adapt tests as needed. - Add or change the documentation as needed. - Push your branch to your fork on gitea, the remote `origin`. -- From your fork open a pull request in the correct branch. Target the project's `develop` or `open_source` branch +- From your fork open a merge request in the correct branch. Target the project's `develop` or `open_source` branch - … -- If we requests further changes just push them to your branch. The PR will be updated automatically. -- Once the pull request is approved and merged you can pull the changes from `upstream` to your local repo and delete +- If we requests further changes just push them to your branch. The MR will be updated automatically. +- Once the merge request is approved and merged you can pull the changes from `upstream` to your local repo and delete your extra branch(es). And last but not least: Always write your commit messages in the present tense. Your commit message should describe what the commit, when applied, does to the code – not what you did to the code. diff --git a/README.md b/README.md index 615e4d758e95b4b556efee9f9487beaf08d90d21..dcd9c19d6ed9a2254cb021904c3cfd982ad237e8 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ VirtualFluids has been used on a variety of platforms: - Cygwin ### Software Requirements - - [CMake](https://cmake.org/) (minimum version 3.13) - - C++ compiler with C++11 support, for example gcc 6.3 or Visual C++ 14.0 + - [CMake](https://cmake.org/) (minimum version 3.15) + - C++ compiler with C++14 support - [Paraview](https://www.paraview.org/) (most recent version) with usage of the GPU: @@ -62,9 +62,7 @@ The doxygen generated documentation can be found [here](https://git.irmb.bau.tu- ## Known Issues -If CMake does not find CUDA_CUT_INCLUDE_DIR use and set the correct CUDA Pathes in gpu.cmake in the base directory in lines 35, 36. - -If you notice any problems on your platform, please report an gitea issue. +If you notice any problems on your platform, please report an issue. ## Authors diff --git a/apps/gpu/LidDrivenCavityGPU/LidDrivenCavity.cpp b/apps/gpu/LidDrivenCavityGPU/LidDrivenCavity.cpp index 4697e58ab37f46baa5be6181771d9b72919243bc..4d2fdc51e94df73cbde1ec92e220e8b5ee5b2943 100644 --- a/apps/gpu/LidDrivenCavityGPU/LidDrivenCavity.cpp +++ b/apps/gpu/LidDrivenCavityGPU/LidDrivenCavity.cpp @@ -332,10 +332,10 @@ int main(int argc, char *argv[]) convergenceAnalyzer.run(iter); } } - } catch (const std::bad_alloc e) { + } catch (const std::bad_alloc& e) { *logging::out << logging::Logger::LOGGER_ERROR << "Bad Alloc:" << e.what() << "\n"; - } catch (const std::exception &e) { + } catch (const std::exception& e) { *logging::out << logging::Logger::LOGGER_ERROR << e.what() << "\n"; } catch (std::string &s) { diff --git a/src/basics/Core/VectorTypes.h b/src/basics/Core/VectorTypes.h index 0256a960ddf53a6d4fb8efee8b54e5d4679987f1..3109112b299e5ac169d9f536a4d4e66b7970cff2 100644 --- a/src/basics/Core/VectorTypes.h +++ b/src/basics/Core/VectorTypes.h @@ -4,9 +4,13 @@ #ifdef __CUDACC__ #include <cuda_runtime.h> #else +#ifndef __host__ #define __host__ +#endif +#ifndef __device__ #define __device__ #endif +#endif #include <cmath> @@ -19,7 +23,7 @@ struct BASICS_EXPORT Vec3 { real x{ c0o1 }, y{ c0o1 }, z{ c0o1 }; __host__ __device__ Vec3(real x, real y, real z) : x(x), y(y), z(z) {} - __host__ __device__ Vec3() = default; + Vec3() = default; __host__ __device__ real length() { return std::sqrt(x * x + y * y + z * z); } diff --git a/src/gpu/GksGpu/CellProperties/CellProperties.cuh b/src/gpu/GksGpu/CellProperties/CellProperties.cuh index 5e49588f73f7b466cc644b45306ae849ca3a3bf0..9b2dd1efc867020044360050d21e89a646f95e4e 100644 --- a/src/gpu/GksGpu/CellProperties/CellProperties.cuh +++ b/src/gpu/GksGpu/CellProperties/CellProperties.cuh @@ -36,9 +36,13 @@ #ifdef __CUDACC__ #include <cuda_runtime.h> #else +#ifndef __host__ #define __host__ +#endif +#ifndef __device__ #define __device__ #endif +#endif ////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/GksMeshAdapter/GksMeshAdapter.cpp b/src/gpu/GksMeshAdapter/GksMeshAdapter.cpp index 3d044555ef521fea8bce18b13080ff01d5f9b17d..a3dc8d8bd47f0497a6b7d233a10ceebb8ab7ce82 100644 --- a/src/gpu/GksMeshAdapter/GksMeshAdapter.cpp +++ b/src/gpu/GksMeshAdapter/GksMeshAdapter.cpp @@ -479,8 +479,6 @@ void GksMeshAdapter::sortFaces() // sort into blocks //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - std::array<char, 3> orientations = {'x', 'y', 'z'}; - for( uint level = 0; level < this->gridBuilder->getNumberOfLevels(); level++ ) { for( uint idx = 0; idx < 3; idx++ ) @@ -488,18 +486,14 @@ void GksMeshAdapter::sortFaces() uint start = this->startOfFacesPerLevelXYZ [ 3 * level + idx]; uint end = start + this->numberOfFacesPerLevelXYZ[ 3 * level + idx]; - real xMax = (*std::max_element(this->faces.begin() + start, this->faces.begin() + end, [this](MeshFace lhs, MeshFace rhs) { return lhs.faceCenter.x < rhs.faceCenter.x; })).faceCenter.x; - real yMax = (*std::max_element(this->faces.begin() + start, this->faces.begin() + end, [this](MeshFace lhs, MeshFace rhs) { return lhs.faceCenter.y < rhs.faceCenter.y; })).faceCenter.y; - real zMax = (*std::max_element(this->faces.begin() + start, this->faces.begin() + end, [this](MeshFace lhs, MeshFace rhs) { return lhs.faceCenter.z < rhs.faceCenter.z; })).faceCenter.z; + // real xMax = (*std::max_element(this->faces.begin() + start, this->faces.begin() + end, [this](MeshFace /lhs, MeshFace rhs) { return lhs.faceCenter.x < rhs.faceCenter.x; })).faceCenter.x; + // real yMax = (*std::max_element(this->faces.begin() + start, this->faces.begin() + end, [this](MeshFace lhs, MeshFace rhs) { return lhs.faceCenter.y < rhs.faceCenter.y; })).faceCenter.y; + // real zMax = (*std::max_element(this->faces.begin() + start, this->faces.begin() + end, [this](MeshFace lhs, MeshFace rhs) { return lhs.faceCenter.z < rhs.faceCenter.z; })).faceCenter.z; real xMin = (*std::min_element(this->faces.begin() + start, this->faces.begin() + end, [this](MeshFace lhs, MeshFace rhs) { return lhs.faceCenter.x < rhs.faceCenter.x; })).faceCenter.x; real yMin = (*std::min_element(this->faces.begin() + start, this->faces.begin() + end, [this](MeshFace lhs, MeshFace rhs) { return lhs.faceCenter.y < rhs.faceCenter.y; })).faceCenter.y; real zMin = (*std::min_element(this->faces.begin() + start, this->faces.begin() + end, [this](MeshFace lhs, MeshFace rhs) { return lhs.faceCenter.z < rhs.faceCenter.z; })).faceCenter.z; - real xRange = xMax - xMin; - real yRange = yMax - yMin; - real zRange = zMax - zMin; - uint blockDim = 8; real dx = this->gridBuilder->getGrid(level)->getDelta(); diff --git a/src/gpu/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h b/src/gpu/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h index b082e6a7402a606b72d08bc28e9b612fa6661974..6d7ae50da444069769daafb3d36f1c0f3093aafc 100644 --- a/src/gpu/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h +++ b/src/gpu/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h @@ -117,7 +117,8 @@ public: void fillVelocityLists() { - for( uint index : this->indices ){ + for( uint index : this->indices ) { + (void) index; this->vxList.push_back(vx); this->vyList.push_back(vy); this->vzList.push_back(vz); diff --git a/src/gpu/GridGenerator/grid/BoundaryConditions/Side.h b/src/gpu/GridGenerator/grid/BoundaryConditions/Side.h index d8dc9a0e4ac8c2825d49dd19148d53538d027a8e..d8bd6134448c3324fec5fef51db8db85c9a0d84e 100644 --- a/src/gpu/GridGenerator/grid/BoundaryConditions/Side.h +++ b/src/gpu/GridGenerator/grid/BoundaryConditions/Side.h @@ -231,6 +231,10 @@ public: return SPtr<Side>(new MZ()); case SideType::PZ: return SPtr<Side>(new PZ()); + case SideType::GEOMETRY: + throw std::runtime_error("SideFactory::make() - SideType::GEOMETRY not supported."); + default: + throw std::runtime_error("SideFactory::make() - SideType not valid."); } } }; diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp index 7cf735197b9fd69c7f85351e659fb31c4818efd6..3b9f91d9ef6e4e2564ff07b24d35630b804d5fa3 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp +++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp @@ -80,7 +80,7 @@ void LevelGridBuilder::setPeriodicBoundaryCondition(bool periodic_X, bool period void LevelGridBuilder::setNoSlipBoundaryCondition(SideType sideType) { - for (int level = 0; level < getNumberOfGridLevels(); level++) + for (uint level = 0; level < getNumberOfGridLevels(); level++) { SPtr<VelocityBoundaryCondition> noSlipBoundaryCondition = VelocityBoundaryCondition::make(0.0, 0.0, 0.0); @@ -162,7 +162,7 @@ std::shared_ptr<Grid> LevelGridBuilder::getGrid(int level, int box) void LevelGridBuilder::checkLevel(int level) { - if (level >= grids.size()) + if (level >= (int)grids.size()) { std::cout << "wrong level input... return to caller\n"; return; @@ -199,7 +199,7 @@ void LevelGridBuilder::getVelocityValues(real* vx, real* vy, real* vz, int* indi int allIndicesCounter = 0; for (auto boundaryCondition : boundaryConditions[level]->velocityBoundaryConditions) { - for(int i = 0; i < boundaryCondition->indices.size(); i++) + for(std::size_t i = 0; i < boundaryCondition->indices.size(); i++) { indices[allIndicesCounter] = grids[level]->getSparseIndex(boundaryCondition->indices[i]) +1; diff --git a/src/gpu/GridGenerator/grid/GridFactory.h b/src/gpu/GridGenerator/grid/GridFactory.h index 5a76d272a3ec045c4abc346d34450ef201733b68..9ebf1e3a13184a9b3aea75694c74e039fc987ad5 100644 --- a/src/gpu/GridGenerator/grid/GridFactory.h +++ b/src/gpu/GridGenerator/grid/GridFactory.h @@ -84,6 +84,8 @@ public: { case Device::CPU: gridStrategy = SPtr<GridStrategy>(new GridCpuStrategy()); break; + case Device::GPU: + throw std::runtime_error("GPU Device for GridGenerator not supported."); } } diff --git a/src/gpu/GridGenerator/grid/GridImp.cu b/src/gpu/GridGenerator/grid/GridImp.cu index e837fa99f95c66eff775c626237c61db2845ef30..ceb00315df89cb8e438705142f4f099adf0c2e0c 100644 --- a/src/gpu/GridGenerator/grid/GridImp.cu +++ b/src/gpu/GridGenerator/grid/GridImp.cu @@ -239,6 +239,8 @@ bool GridImp::isNode(uint index, char type) const { if( index != INVALID_INDEX ) return field.is(index, type); + + throw std::runtime_error("GridImp::isNode() -> index == INVALID_INDEX not supported."); } bool GridImp::isValidEndOfGridStopper(uint index) const diff --git a/src/gpu/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.cpp b/src/gpu/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.cpp index 38a711cb60f3ca9c0e47cbdfec211e04b8cd47f9..ac63339582e3aed6c2d644807dbd44db9725b3c3 100644 --- a/src/gpu/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.cpp +++ b/src/gpu/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.cpp @@ -52,14 +52,14 @@ void GridCpuStrategy::allocateGridMemory(SPtr<GridImp> grid) grid->sparseIndices = new int[grid->size]; grid->qIndices = new uint[grid->size]; - for (size_t i = 0; i < grid->size; i++) + for (uint i = 0; i < grid->size; i++) grid->qIndices[i] = INVALID_INDEX; } void GridCpuStrategy::initalNodesToOutOfGrid(SPtr<GridImp> grid) { #pragma omp parallel for - for (int index = 0; index < grid->size; index++) + for (int index = 0; index < (int)grid->size; index++) grid->initalNodeToOutOfGrid(index); } @@ -72,14 +72,14 @@ void GridCpuStrategy::allocateFieldMemory(Field* field) void GridCpuStrategy::findInnerNodes(SPtr<GridImp> grid) { #pragma omp parallel for - for (int index = 0; index < grid->size; index++) + for (int index = 0; index < (int)grid->size; index++) grid->findInnerNode(index); } void GridCpuStrategy::findEndOfGridStopperNodes(SPtr<GridImp> grid) { #pragma omp parallel for - for (int index = 0; index < grid->size; index++) + for (int index = 0; index < (int)grid->size; index++) grid->findEndOfGridStopperNode(index); } @@ -102,7 +102,7 @@ void GridCpuStrategy::findSparseIndices(SPtr<GridImp> coarseGrid, SPtr<GridImp> void GridCpuStrategy::findForNeighborsNewIndices(SPtr<GridImp> grid) { #pragma omp parallel for - for (int index = 0; index < grid->getSize(); index++) + for (int index = 0; index < (int)grid->getSize(); index++) grid->setNeighborIndices(index); } diff --git a/src/gpu/GridGenerator/grid/distributions/Distribution.cpp b/src/gpu/GridGenerator/grid/distributions/Distribution.cpp index c588678ae58470a945004a2d1da55f3bb603c796..0aa7e40577172a9e0988f610a822729a34b71b8e 100644 --- a/src/gpu/GridGenerator/grid/distributions/Distribution.cpp +++ b/src/gpu/GridGenerator/grid/distributions/Distribution.cpp @@ -246,8 +246,8 @@ std::vector<std::vector<real> > DistributionHelper::getVectorWithoutRowsWithOnly { std::vector<std::vector<real> > qs_ausgeduennt; bool hasQs = false; - for (int node = 0; node < qs.size(); node++) { - for (int dir = 0; dir < qs[node].size() - 1; dir++) { + for (std::size_t node = 0; node < qs.size(); node++) { + for (std::size_t dir = 0; dir < qs[node].size() - 1; dir++) { if (qs[node][dir + 1] != 0) hasQs = true; } @@ -262,9 +262,9 @@ std::vector<std::vector<real> > DistributionHelper::getVectorWithoutRowsWithOnly void DistributionHelper::printQs(std::vector<std::vector<real> > qs, int decimalPlaces) { - for (int node = 0; node < qs.size(); node++) { - printf("index %d: ", node); - for (int dir = 1; dir < qs[node].size(); dir++) { + for (std::size_t node = 0; node < qs.size(); node++) { + printf("index %lu: ", node); + for (std::size_t dir = 1; dir < qs[node].size(); dir++) { printf("%d ", (int)qs[node][0]); printf("%.*f ", decimalPlaces, qs[node][dir]); } diff --git a/src/gpu/VirtualFluids_GPU/Init/InitLattice.cpp b/src/gpu/VirtualFluids_GPU/Init/InitLattice.cpp index 5a7ab64a654dd32277086925295e87a548aebb89..96c4284fb5ecff94c33d2b61ab068ed41a9d3f19 100644 --- a/src/gpu/VirtualFluids_GPU/Init/InitLattice.cpp +++ b/src/gpu/VirtualFluids_GPU/Init/InitLattice.cpp @@ -37,7 +37,6 @@ //////////////////////////////////////////////////////////////////////////////// void initLattice(SPtr<Parameter> para) { - unsigned lev = 0; ////////////////////////////////////////////////////////////////////////// para->getParD()->isEvenTimestep = true; ////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/VirtualFluids_GPU/Output/FileWriter.cpp b/src/gpu/VirtualFluids_GPU/Output/FileWriter.cpp index 5f3b275c528b97b31d1961ca5f90d049ddcef441..d07131fab01515893025bd43db9898bd70191cd4 100644 --- a/src/gpu/VirtualFluids_GPU/Output/FileWriter.cpp +++ b/src/gpu/VirtualFluids_GPU/Output/FileWriter.cpp @@ -38,7 +38,6 @@ void FileWriter::writeInit(SPtr<Parameter> para, SPtr<CudaMemoryManager> cudaManager) { uint timestep = 0; - uint level = 0; cudaManager->cudaCopyDataToHost(); writeTimestep(para, timestep); } @@ -81,7 +80,6 @@ void FileWriter::writeUnstrucuredGridLT(SPtr<Parameter> para, std::vector<std::s unsigned int number1, number2, number3, number4, number5, number6, number7, number8; unsigned int dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8; bool neighborsAreFluid; - double vxmax = 0; unsigned int startpos = 0; unsigned int endpos = 0; unsigned int sizeOfNodes = 0;