Vector arrays
cyrush opened this issue · 1 comments
Discussed in #1328
Originally posted by yslan July 10, 2024
Hi,
I wonder what's the proper way to pass a vector field to Ascent.
-
3 scalars
I know we can break it into scalars like this.mesh_data["fields/velocity_x/association"] = "vertex"; mesh_data["fields/velocity_x/topology"] = "mesh"; mesh_data["fields/velocity_x/values"].set_external((dfloat *)o_u.ptr(), N); mesh_data["fields/velocity_y/association"] = "vertex"; mesh_data["fields/velocity_y/topology"] = "mesh"; mesh_data["fields/velocity_y/values"].set_external((dfloat *)o_v.ptr(), N); mesh_data["fields/velocity_z/association"] = "vertex"; mesh_data["fields/velocity_z/topology"] = "mesh"; mesh_data["fields/velocity_z/values"].set_external((dfloat *)o_w.ptr(), N);
And, we can composite back to vector in
ascent_actions.yaml
This approach is robust and well-tested in my code. -
vector
I've also managed to send the vector like this (Is this the correct way?).mesh_data["fields/velocity/association"] = "vertex"; mesh_data["fields/velocity/topology"] = "mesh"; mesh_data["fields/velocity/values/u"].set_external((dfloat *)o_u.ptr(), N); mesh_data["fields/velocity/values/v"].set_external((dfloat *)o_v.ptr(), N); mesh_data["fields/velocity/values/w"].set_external((dfloat *)o_w.ptr(), N);
Then, from vector, it can extract components in
ascent_actions.yaml
-
Can we have both?
The question occurs when I have both vector and 3-scalars implementation with the same pointer.
The idea is to keep "vector of arrays" structure, but also make sure both vector and scalar components are visible in ascent_actions.yaml, which saves a lots of conversion.
This works when I run it on CPU backend but it gets SEGV when running with GPU. Both CPU and GPU are tested on Polaris.
I appreciate any suggestions.
Thanks,
Yu-Hsiang
Second case (presented as a vector field directly) is crashing for GPU case.