Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing strided array without copying #1468

Open
odarbs opened this issue Mar 5, 2025 · 2 comments
Open

Accessing strided array without copying #1468

odarbs opened this issue Mar 5, 2025 · 2 comments

Comments

@odarbs
Copy link

odarbs commented Mar 5, 2025

I have setup a simple uniform mesh of a cube and am trying to associate a strided array with a field using set_external, the data layout is an array of structures of 5 floats and I believe I can pass that information to the conduit node by giving it the offset, stride and size of the element all in bytes:

mesh["fields/V/values"].set_external(cellData.device, numCells, 1 * sizeof(float), 5 * sizeof(float), sizeof(float));

when I pass the host side pointer I get the following error:

Execution failed with vtkm: Could not find appropriate cast for array in CastAndCall.
Array: valueType=float storageType=vtkm::cont::StorageTagStride 16777216 values occupying 67108864 bytes [1 1 1 ... 1 1 1]
TypeList: vtkm::List<float, double>

when I pass the device side pointer I get a seg fault.

If I don't pass any of the offset and stride information everything works and I can generate a plot of the field, it's just stripy! Is this type of AoS data layout supported or do I need to take a different approach?

@cyrush
Copy link
Member

cyrush commented Mar 5, 2025

We should be able to support this -- but we may need to check the paths where we wrap strided data.

Q: Is this on an NVIDIA system?

@odarbs
Copy link
Author

odarbs commented Mar 5, 2025

Great. Yes this is on an NVIDIA system, I'm using version 12.6 of the CUDA toolkit to build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants