Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastián Barschkis <sebbas@sebbas.org>2021-09-13 16:03:52 +0300
committerSebastián Barschkis <sebbas@sebbas.org>2021-09-13 16:03:52 +0300
commit063ce7f550f1612ab0e34c4ecb4b57f8401b84b4 (patch)
tree53584b6c514510b0bab33a480b3ec85274b48a6b /extern/mantaflow/preprocessed/fileio/iovdb.cpp
parent4b06420e65040c642d2b0a7a1c9bf7515d3cec0c (diff)
Fluid: Initial changes for OpenMP GPU supportfluid-mantaflow-gpu
Contains basic support for OpenMP GPU offloading. That is, offloading of fluid KERNEL loops to the GPU. This branch offloads pressure and advection calls only - the 2 most expensive operation per step. In theory though, any function can be offloaded. For now, this branch needs to be build with a compiler that supports Nvidia GPU offloading. Exact GPU models need to be specified via CMake.
Diffstat (limited to 'extern/mantaflow/preprocessed/fileio/iovdb.cpp')
-rw-r--r--extern/mantaflow/preprocessed/fileio/iovdb.cpp55
1 files changed, 23 insertions, 32 deletions
diff --git a/extern/mantaflow/preprocessed/fileio/iovdb.cpp b/extern/mantaflow/preprocessed/fileio/iovdb.cpp
index 1846ef7ecbb..815bfa19aaa 100644
--- a/extern/mantaflow/preprocessed/fileio/iovdb.cpp
+++ b/extern/mantaflow/preprocessed/fileio/iovdb.cpp
@@ -29,10 +29,10 @@
#if OPENVDB == 1
# include "openvdb/openvdb.h"
-# include "openvdb/points/PointConversion.h"
-# include "openvdb/points/PointCount.h"
-# include "openvdb/tools/Clip.h"
-# include "openvdb/tools/Dense.h"
+# include <openvdb/points/PointConversion.h>
+# include <openvdb/points/PointCount.h>
+# include <openvdb/tools/Clip.h>
+# include <openvdb/tools/Dense.h>
#endif
#define POSITION_NAME "P"
@@ -433,9 +433,9 @@ int writeObjectsVDB(const string &filename,
debMsg("Writing int grid '" << mantaGrid->getName() << "' to vdb file " << filename, 1);
Grid<int> *mantaIntGrid = (Grid<int> *)mantaGrid;
if (clipGrid && mantaIntGrid->saveSparse()) {
- assertMsg(clipGrid->getSize() == mantaGrid->getSize(),
- "writeObjectsVDB: Clip grid and exported grid must have the same size "
- << clipGrid->getSize() << " vs " << mantaGrid->getSize());
+ // assertMsg(clipGrid->getSize() == mantaGrid->getSize(), "writeObjectsVDB: Clip grid and
+ // exported grid must have the same size " << clipGrid->getSize() << " vs " <<
+ // mantaGrid->getSize());
}
vdbGrid = exportVDB<int, openvdb::Int32Grid>(mantaIntGrid, clip, vdbClipGrid);
gridsVDB.push_back(vdbGrid);
@@ -448,9 +448,9 @@ int writeObjectsVDB(const string &filename,
// Only supply clip grid if real grid is not equal to the clip grid
openvdb::FloatGrid::Ptr tmpClipGrid = (mantaRealGrid == clipGrid) ? nullptr : vdbClipGrid;
if (clipGrid && mantaRealGrid->saveSparse()) {
- assertMsg(clipGrid->getSize() == mantaGrid->getSize(),
- "writeObjectsVDB: Clip grid and exported grid must have the same size "
- << clipGrid->getSize() << " vs " << mantaGrid->getSize());
+ // assertMsg(clipGrid->getSize() == mantaGrid->getSize(), "writeObjectsVDB: Clip grid and
+ // exported grid must have the same size " << clipGrid->getSize() << " vs " <<
+ // mantaGrid->getSize());
}
vdbGrid = exportVDB<Real, openvdb::FloatGrid>(mantaRealGrid, clip, tmpClipGrid);
gridsVDB.push_back(vdbGrid);
@@ -461,9 +461,9 @@ int writeObjectsVDB(const string &filename,
openvdb::GRID_UNKNOWN;
Grid<Vec3> *mantaVec3Grid = (Grid<Vec3> *)mantaGrid;
if (clipGrid && mantaVec3Grid->saveSparse()) {
- assertMsg(clipGrid->getSize() == mantaGrid->getSize(),
- "writeObjectsVDB: Clip grid and exported grid must have the same size "
- << clipGrid->getSize() << " vs " << mantaGrid->getSize());
+ // assertMsg(clipGrid->getSize() == mantaGrid->getSize(), "writeObjectsVDB: Clip grid and
+ // exported grid must have the same size " << clipGrid->getSize() << " vs " <<
+ // mantaGrid->getSize());
}
vdbGrid = exportVDB<Vec3, openvdb::Vec3SGrid>(mantaVec3Grid, clip, vdbClipGrid);
gridsVDB.push_back(vdbGrid);
@@ -519,7 +519,7 @@ int writeObjectsVDB(const string &filename,
}
}
- // Write only if there is at least one grid, optionally write with compression.
+ // Write only if the is at least one grid, optionally write with compression.
if (gridsVDB.size()) {
int vdb_flags = openvdb::io::COMPRESS_ACTIVE_MASK;
switch (compression) {
@@ -534,8 +534,7 @@ int writeObjectsVDB(const string &filename,
}
case COMPRESSION_BLOSC: {
# if OPENVDB_BLOSC == 1
- // Cannot use |= here, causes segfault with blosc 1.5.0 (== recommended version)
- vdb_flags = openvdb::io::COMPRESS_BLOSC;
+ vdb_flags |= openvdb::io::COMPRESS_BLOSC;
# else
debMsg("OpenVDB was built without Blosc support, using Zip compression instead", 1);
vdb_flags |= openvdb::io::COMPRESS_ZIP;
@@ -696,36 +695,28 @@ int readObjectsVDB(const string &filename, std::vector<PbClass *> *objects, floa
// Compare metadata with allocated grid setup. This prevents invalid index access.
if (notZero(metaRes) && metaRes != origRes) {
- debMsg("readObjectsVDB Warning: Grid '" << vdbGrid->getName()
- << "' has not been read. Meta grid res " << metaRes
- << " vs " << origRes << " current grid size",
- 1);
+ // debMsg("readObjectsVDB Warning: Grid '" << vdbGrid->getName() << "' has not been read.
+ // Meta grid res " << metaRes << " vs " << origRes << " current grid size", 1);
readFailure++;
break;
}
if (notZero(metaVoxelSize) && metaVoxelSize != voxelSize) {
- debMsg("readObjectsVDB Warning: Grid '"
- << vdbGrid->getName() << "' has not been read. Meta voxel size "
- << metaVoxelSize << " vs " << voxelSize << " current voxel size",
- 1);
+ // debMsg("readObjectsVDB Warning: Grid '" << vdbGrid->getName() << "' has not been read.
+ // Meta voxel size " << metaVoxelSize << " vs " << voxelSize << " current voxel size", 1);
readFailure++;
break;
}
if (metaBBoxMax.x > origRes.x || metaBBoxMax.y > origRes.y || metaBBoxMax.z > origRes.z) {
- debMsg("readObjectsVDB Warning: Grid '"
- << vdbGrid->getName() << "' has not been read. Vdb bbox max " << metaBBoxMax
- << " vs " << origRes << " current grid size",
- 1);
+ // debMsg("readObjectsVDB Warning: Grid '" << vdbGrid->getName() << "' has not been read.
+ // Vdb bbox max " << metaBBoxMax << " vs " << origRes << " current grid size", 1);
readFailure++;
break;
}
const Vec3i origOrigin(0);
if (metaBBoxMin.x < origOrigin.x || metaBBoxMin.y < origOrigin.y ||
metaBBoxMin.z < origOrigin.z) {
- debMsg("readObjectsVDB Warning: Grid '"
- << vdbGrid->getName() << "' has not been read. Vdb bbox min " << metaBBoxMin
- << " vs " << origOrigin << " current grid origin",
- 1);
+ // debMsg("readObjectsVDB Warning: Grid '" << vdbGrid->getName() << "' has not been read.
+ // Vdb bbox min " << metaBBoxMin << " vs " << origOrigin << " current grid origin", 1);
readFailure++;
break;
}