Replies: 2 comments
-
Using C, I think is the most portable solution. Since we need this in several places, not only gmres, I would suggest to move the Other opinions @timofeymukha @MartinKarp? |
Beta Was this translation helpful? Give feedback.
0 replies
-
I think it would be really nice to have it as one contiguous chunk. I also agree that moving it to device makes a lot of sense |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Was looking at the GMRES code at the suggestion of Niclas, and one of the slightly annoying things is that the 2d arrays like z_d are implemented as an array of pointers to data, so you do not necessarily contiguous chunks of memory.
Wrote something small in feature/gmres_alloc_opt which updates the device_gmres to allocate one chunk of memory, then set up the z_d chunks to point to individual parts.
As you cannot do pointer arithmetic in Fortran in general (apparently converting everything to ints, and doing integer arithmetic works, but that is not a good solution either), I added a small C routine to do the pointer arithmetic, and put the details in a small temporary array that we then copy back in the z_d
Anwyay was looking at some feedback to see if there was a better way to do this, or if other places needed it. Clearly there are two more arrays in gmres for example that do the same thing, but there are probably more.
Beta Was this translation helpful? Give feedback.
All reactions