diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2021-09-13 16:03:52 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2021-09-13 16:03:52 +0300 |
commit | 063ce7f550f1612ab0e34c4ecb4b57f8401b84b4 (patch) | |
tree | 53584b6c514510b0bab33a480b3ec85274b48a6b /extern/curve_fit_nd | |
parent | 4b06420e65040c642d2b0a7a1c9bf7515d3cec0c (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/curve_fit_nd')
-rw-r--r-- | extern/curve_fit_nd/intern/curve_fit_corners_detect.c | 2 | ||||
-rw-r--r-- | extern/curve_fit_nd/intern/curve_fit_cubic.c | 10 | ||||
-rw-r--r-- | extern/curve_fit_nd/intern/curve_fit_inline.h | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/extern/curve_fit_nd/intern/curve_fit_corners_detect.c b/extern/curve_fit_nd/intern/curve_fit_corners_detect.c index 415ef40fdd5..b600a41f9cd 100644 --- a/extern/curve_fit_nd/intern/curve_fit_corners_detect.c +++ b/extern/curve_fit_nd/intern/curve_fit_corners_detect.c @@ -81,7 +81,7 @@ static double cos_vnvnvn( normalize_vn_vnvn(dvec1, v1, v2, dims); double d = dot_vnvn(dvec0, dvec1, dims); /* sanity check */ - d = max(-1.0, min(1.0, d)); + d = maxV(-1.0, minV(1.0, d)); return d; } diff --git a/extern/curve_fit_nd/intern/curve_fit_cubic.c b/extern/curve_fit_nd/intern/curve_fit_cubic.c index 47c5344c821..65042d7dbef 100644 --- a/extern/curve_fit_nd/intern/curve_fit_cubic.c +++ b/extern/curve_fit_nd/intern/curve_fit_cubic.c @@ -29,9 +29,9 @@ * \ingroup curve_fit */ -#ifdef _MSC_VER +//#ifdef _MSC_VER # define _USE_MATH_DEFINES -#endif +//#endif #include <math.h> #include <float.h> @@ -456,7 +456,7 @@ static double points_calc_circumference_factor( const double len_tangent = dot < 0.0 ? len_vnvn(tan_l, tan_r, dims) : len_negated_vnvn(tan_l, tan_r, dims); if (len_tangent > DBL_EPSILON) { /* only clamp to avoid precision error */ - double angle = acos(max(-fabs(dot), -1.0)); + double angle = acos(maxV(-fabs(dot), -1.0)); /* Angle may be less than the length when the tangents define >180 degrees of the circle, * (tangents that point away from each other). * We could try support this but will likely cause extreme >1 scales which could cause other issues. */ @@ -607,7 +607,7 @@ static void cubic_from_points_offset_fallback( for (uint k = 0; k < 2; k++) { sub_vn_vnvn(tmp, p0, pt, dims); project_vn_vnvn_normalized(tmp, tmp, a[k], dims); - dists[k] = max(dists[k], dot_vnvn(tmp, a[k], dims)); + dists[k] = maxV(dists[k], dot_vnvn(tmp, a[k], dims)); } } @@ -796,7 +796,7 @@ static void cubic_from_points( dist_sq_test += sq((pt[j] - center[j]) * clamp_scale); } #endif - dist_sq_max = max(dist_sq_max, dist_sq_test); + dist_sq_max = maxV(dist_sq_max, dist_sq_test); } } diff --git a/extern/curve_fit_nd/intern/curve_fit_inline.h b/extern/curve_fit_nd/intern/curve_fit_inline.h index f9eaa4c647c..6b47d3c12b0 100644 --- a/extern/curve_fit_nd/intern/curve_fit_inline.h +++ b/extern/curve_fit_nd/intern/curve_fit_inline.h @@ -45,12 +45,12 @@ MINLINE double sq(const double d) } #ifndef _MSC_VER -MINLINE double min(const double a, const double b) +MINLINE double minV(const double a, const double b) { return b < a ? b : a; } -MINLINE double max(const double a, const double b) +MINLINE double maxV(const double a, const double b) { return a < b ? b : a; } |