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

GPU compatibility of data types #13

Closed
youngdae opened this issue Dec 23, 2020 · 1 comment
Closed

GPU compatibility of data types #13

youngdae opened this issue Dec 23, 2020 · 1 comment

Comments

@youngdae
Copy link
Member

I'm not sure if I'm not doing wrong, but user-defined data types, such as TronSparseMatrixCSC and TronDenseMatrix, seem to cause issues in passing them to a kernel function; compilation fails with complaints that it is a non-bitstype argument.

For example, the following call generates an error.

function kernel(p)
    @cuprintln(p.diag_vals) # It does not matter if I call @cuprintln or not. Compiling this will fail.
    return
end

d = ExaTron.TronSparseMatrixCSC(I, J, V, 8) # I, J, and V are CuArrays of types Int (I,J) and Float64 (V)
@cuda threads=128 blocks=1 kernel(d)

I was trying to implement a batch-solve of Tron, and I was thinking of doing this by calling dtron routines for each thread block in a kernel. However, dtron takes aforementioned user-defined data types, leading to failures. I guess all the internal routines using user-defined data types would cause issues in this case.

I'm a bit concerned that we might have to go back to the original implementation where bitstype arrays were used, which means dismantling Matrix into array components.

What do you think? Am I doing something wrong?

@frapac
Copy link
Member

frapac commented Dec 24, 2020

I don't think we could pass user types directly into CUDA's kernels. What we did in ExaPF is dismantling types in subcomponents before passing them to the kernels, e.g.
https://github.com/exanauts/ExaPF.jl/blob/master/src/models/polar/kernels.jl#L150-L154

In that sense, it is better to have struct of arrays rather than arrays of struct when we want to use GPU.
In ExaTron, I think we have the right structure for the matrix, and I would be in favor of dismantling the matrix into array components, as you said.

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

3 participants