Skip to content

Commit

Permalink
Merge branch 'develop' into task/2025_05_mixed_ele_umeshs
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrush committed Jul 11, 2024
2 parents 04998b1 + a5f51b4 commit 148ae82
Show file tree
Hide file tree
Showing 9 changed files with 200 additions and 10 deletions.
10 changes: 5 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
########################

variables:
ubuntu_20_04_tag: alpinedav/ascent-devel:ubuntu-20.04-x86_64-tpls_2024-05-03-sha29a328
ubuntu_22_04_tag: alpinedav/ascent-devel:ubuntu-22.04-x86_64-tpls_2024-05-09-shaa5bd0a
ubuntu_20_04_cuda_11_4_3_tag: alpinedav/ascent-devel:ubuntu-20.04-cuda-11.4.3-x86_64-tpls_2024-05-10-shaa5bd0a
ubuntu_20_04_cuda_12_1_1_tag: alpinedav/ascent-devel:ubuntu-20.04-cuda-12.1.1-x86_64-tpls_2024-05-10-shaa5bd0a
ubuntu_20_04_rocm_6_0_0_tag: alpinedav/ascent-devel:ubuntu-20.04-rocm-6.0.0--x86_64-build-ascent-tpls_2024-05-09-shaa5bd0a
ubuntu_20_04_tag: alpinedav/ascent-devel:ubuntu-20.04-x86_64-tpls_2024-07-09-sha3a1ef8
ubuntu_22_04_tag: alpinedav/ascent-devel:ubuntu-22.04-x86_64-tpls_2024-07-10-sha3a1ef8
ubuntu_20_04_cuda_11_4_3_tag: alpinedav/ascent-devel:ubuntu-20.04-cuda-11.4.3-x86_64-tpls_2024-07-09-sha3a1ef8
ubuntu_20_04_cuda_12_1_1_tag: alpinedav/ascent-devel:ubuntu-20.04-cuda-12.1.1-x86_64-tpls_2024-07-09-sha3a1ef8
ubuntu_20_04_rocm_6_0_0_tag: alpinedav/ascent-devel:ubuntu-20.04-rocm-6.0.0--x86_64-build-ascent-tpls_2024-07-10-sha3a1ef8


# only build merge target pr to develop
Expand Down
43 changes: 43 additions & 0 deletions scripts/build_ascent/2024_07_02_vtkm-mr3246-raysubset_bugfix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
From 763f13306b719bf6a213d00ead13fc93433e942e Mon Sep 17 00:00:00 2001
From: Cyrus Harrison <[email protected]>
Date: Tue, 2 Jul 2024 10:28:43 -0700
Subject: [PATCH] fix bug with ray subsetting using wrong near and far planes

---
vtkm/rendering/raytracing/Camera.cxx | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/vtkm/rendering/raytracing/Camera.cxx b/vtkm/rendering/raytracing/Camera.cxx
index f2a39bef9..10febf39f 100644
--- a/vtkm/rendering/raytracing/Camera.cxx
+++ b/vtkm/rendering/raytracing/Camera.cxx
@@ -830,6 +830,7 @@ void Camera::FindSubset(const vtkm::Bounds& bounds)
transformed[2] = (transformed[2] * 0.5f + 0.5f);
zmin = vtkm::Min(zmin, transformed[2]);
zmax = vtkm::Max(zmax, transformed[2]);
+ // skip if outside near and far clipping
if (transformed[2] < 0 || transformed[2] > 1)
{
continue;
@@ -894,15 +895,10 @@ VTKM_CONT void Camera::UpdateDimensions(Ray<Precision>& rays,
this->CameraView.SetLookAt(this->GetLookAt());
this->CameraView.SetPosition(this->GetPosition());
this->CameraView.SetViewUp(this->GetUp());
- //
- // Just create come clipping range, we ignore the zmax value in subsetting
- //
- vtkm::Float64 maxDim = vtkm::Max(
- boundingBox.X.Max - boundingBox.X.Min,
- vtkm::Max(boundingBox.Y.Max - boundingBox.Y.Min, boundingBox.Z.Max - boundingBox.Z.Min));

- maxDim *= 100;
- this->CameraView.SetClippingRange(.0001, maxDim);
+ // Note:
+ // Use clipping range provided, the subsetting does take into consideration
+ // the near and far clipping planes.

//Update our ViewProjection matrix
this->ViewProjectionMat =
--
2.39.3 (Apple Git-145)

3 changes: 2 additions & 1 deletion scripts/build_ascent/build_ascent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ set | grep build_
################
# Zlib
################
zlib_version=1.3
zlib_version=1.3.1
zlib_src_dir=$(ospath ${root_dir}/zlib-${zlib_version})
zlib_build_dir=$(ospath ${root_dir}/build/zlib-${zlib_version}/)
zlib_install_dir=$(ospath ${install_dir}/zlib-${zlib_version}/)
Expand Down Expand Up @@ -364,6 +364,7 @@ if [ ! -d ${vtkm_src_dir} ]; then
cd ${vtkm_src_dir}
patch -p1 < ${script_dir}/2023_12_06_vtkm-mr3160-rocthrust-fix.patch
patch -p1 < ${script_dir}/2024_05_03_vtkm-mr3215-ext-geom-fix.patch
patch -p1 < ${script_dir}/2024_07_02_vtkm-mr3246-raysubset_bugfix.patch
cd ${root_dir}
fi

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
From 763f13306b719bf6a213d00ead13fc93433e942e Mon Sep 17 00:00:00 2001
From: Cyrus Harrison <[email protected]>
Date: Tue, 2 Jul 2024 10:28:43 -0700
Subject: [PATCH] fix bug with ray subsetting using wrong near and far planes

---
vtkm/rendering/raytracing/Camera.cxx | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/vtkm/rendering/raytracing/Camera.cxx b/vtkm/rendering/raytracing/Camera.cxx
index f2a39bef9..10febf39f 100644
--- a/vtkm/rendering/raytracing/Camera.cxx
+++ b/vtkm/rendering/raytracing/Camera.cxx
@@ -830,6 +830,7 @@ void Camera::FindSubset(const vtkm::Bounds& bounds)
transformed[2] = (transformed[2] * 0.5f + 0.5f);
zmin = vtkm::Min(zmin, transformed[2]);
zmax = vtkm::Max(zmax, transformed[2]);
+ // skip if outside near and far clipping
if (transformed[2] < 0 || transformed[2] > 1)
{
continue;
@@ -894,15 +895,10 @@ VTKM_CONT void Camera::UpdateDimensions(Ray<Precision>& rays,
this->CameraView.SetLookAt(this->GetLookAt());
this->CameraView.SetPosition(this->GetPosition());
this->CameraView.SetViewUp(this->GetUp());
- //
- // Just create come clipping range, we ignore the zmax value in subsetting
- //
- vtkm::Float64 maxDim = vtkm::Max(
- boundingBox.X.Max - boundingBox.X.Min,
- vtkm::Max(boundingBox.Y.Max - boundingBox.Y.Min, boundingBox.Z.Max - boundingBox.Z.Min));

- maxDim *= 100;
- this->CameraView.SetClippingRange(.0001, maxDim);
+ // Note:
+ // Use clipping range provided, the subsetting does take into consideration
+ // the near and far clipping planes.

//Update our ViewProjection matrix
this->ViewProjectionMat =
--
2.39.3 (Apple Git-145)

4 changes: 4 additions & 0 deletions scripts/uberenv_configs/packages/vtk-m/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ class VtkM(CMakePackage, CudaPackage, ROCmPackage):
# https://gitlab.kitware.com/vtk/vtk-m/-/merge_requests/3160
patch("mr3160-rocthrust-fix.patch", when="@2.1:")

# VTK-M future PR
#
patch("2024_07_02_vtkm-mr3246-raysubset_bugfix.patch", when="@2.1:")

def cmake_args(self):
spec = self.spec
options = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,21 +260,21 @@ using ReduceMaxLoc = RAJA::ReduceMaxLoc<ExecPolicy,T>;

//---------------------------------------------------------------------------//
template <typename ExecPolicy, typename T>
ASCENT_EXEC T atomic_add(T volatile *acc, T value)
ASCENT_EXEC T atomic_add(T *acc, T value)
{
return RAJA::atomicAdd(ExecPolicy{}, acc, value);
}

//---------------------------------------------------------------------------//
template <typename ExecPolicy, typename T>
ASCENT_EXEC T atomic_min(T volatile *acc, T value)
ASCENT_EXEC T atomic_min(T *acc, T value)
{
return RAJA::atomicMin(ExecPolicy{}, acc, value);
}

//---------------------------------------------------------------------------//
template <typename ExecPolicy, typename T>
ASCENT_EXEC T atomic_max(T volatile *acc, T value)
ASCENT_EXEC T atomic_max(T *acc, T value)
{
return RAJA::atomicMax(ExecPolicy{}, acc, value);
}
Expand Down
2 changes: 1 addition & 1 deletion src/libs/dray/utils/appstats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ StatStore::write_point_stats(const std::string &ofile_base)
file.close();
m_point_stats.clear();
#else
(void) name;
(void) ofile_base;
#endif
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
99 changes: 99 additions & 0 deletions src/tests/ascent/t_ascent_render_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2878,6 +2878,105 @@ TEST(ascent_render_3d, test_render_3d_extreme_extents)
}



// //-----------------------------------------------------------------------------
TEST(ascent_render_3d, test_render_3d_ray_zcull_bug)
{
//
// this test exercises a ray culling bug in vtk-m
// the bug improperly culls rays that are valid due to a bad
// check related to the near and far plane
// we have a patch and will work on getting a fixed in to 2.2
//

// the ascent runtime is currently our only rendering runtime
Node n;
ascent::about(n);
// only run this test if ascent was built with vtkm support
if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
{
ASCENT_INFO("Ascent support disabled, skipping 3D default"
"Pipeline test");

return;
}

// create a tiny mesh that will be far away from the camera
Node mesh;
mesh["state/cycle"] = 100;
int num_per_dim = 6;
// create the coordinate set
mesh["coordsets/coords/type"] = "uniform";
mesh["coordsets/coords/dims/i"] = num_per_dim;
mesh["coordsets/coords/dims/j"] = num_per_dim;
mesh["coordsets/coords/dims/k"] = num_per_dim;

// add origin and spacing to the coordset (optional)
mesh["coordsets/coords/origin/x"].set_float64(-3.0);
mesh["coordsets/coords/origin/y"].set_float64(-3.0);
mesh["coordsets/coords/origin/z"].set_float64(10000.0);

mesh["coordsets/coords/spacing/dx"] = 1.0;
mesh["coordsets/coords/spacing/dy"] = 1.0;
mesh["coordsets/coords/spacing/dz"] = 1.0;

// add the topology
// this case is simple b/c it's implicitly derived from the coordinate set
mesh["topologies/topo/type"] = "uniform";
// reference the coordinate set by name
mesh["topologies/topo/coordset"] = "coords";

int num_verts = num_per_dim * num_per_dim * num_per_dim; // 3D
// create a vertex associated field named alternating
mesh["fields/vert_ids/association"] = "vertex";
mesh["fields/vert_ids/topology"] = "topo";
mesh["fields/vert_ids/values"].set(DataType::float64(num_verts));
float64_array vals_vert_ids = mesh["fields/vert_ids/values"].value();

for(index_t i=0;i< num_verts;i++)
{
vals_vert_ids[i] = i;
}

string output_path = prepare_output_dir();
string output_file = conduit::utils::join_file_path(output_path,
"tout_render_3d_ray_z_cull_bug");
// remove old images before rendering
remove_test_image(output_file);

conduit::Node actions;
conduit::Node &add_plots = actions.append();
add_plots["action"] = "add_scenes";
conduit::Node &scenes = add_plots["scenes"];
scenes["s1/plots/p1/type"] = "pseudocolor";
scenes["s1/plots/p1/field"] = "vert_ids";

Node &r1 = scenes["s1/renders/r1"];

std::string cam_yaml = R"INLINE(
world_annotations: false
camera:
fov: 30.0
look_at: [0.0,0.0,10000.0]
position: [0.0,0.0,0.0]
up: [0.0, 1.0, 0.0]
zoom: [100]
near_plane: 9000.0
far_plane: 11000.0
)INLINE";
r1.parse(cam_yaml,"yaml");

r1["image_prefix"] = output_file;
std::cout << actions.to_yaml() << std::endl;
Ascent ascent;
ascent.open();
ascent.publish(mesh);
ascent.execute(actions);
// check that we created an image
EXPECT_TRUE(check_test_image(output_file));

}

//-----------------------------------------------------------------------------
int main(int argc, char* argv[])
{
Expand Down

0 comments on commit 148ae82

Please sign in to comment.