Scalar Indexing is not allowed on GPU array (KH instability) #3527
Replies: 17 comments 6 replies
-
What line triggers the error? |
Beta Was this translation helpful? Give feedback.
-
@sangeethasankar01 if you post the whole error message that you get with the stack trace we will understand more which line triggered this error. |
Beta Was this translation helpful? Give feedback.
-
This is an error message I am getting from my code. Please share your comments on how to resolve this issue. |
Beta Was this translation helpful? Give feedback.
-
thanks! ps: enclosing code/error in triple backticks
makes it much more readable. (You can edit the post and enclose the error msg in triple backticks) |
Beta Was this translation helpful? Give feedback.
-
seems that the issue is coming from I'll try to reproduce this. |
Beta Was this translation helpful? Give feedback.
-
Try rescale_factor = CUDA.@allowscalar √(target_kinetic_energy / energy[1, 1, 1]) |
Beta Was this translation helpful? Give feedback.
-
You might have to call using CUDA at the top of the script. |
Beta Was this translation helpful? Give feedback.
-
@glwagner As you mentioned, I attempted to follow your suggestion by specifying the Code:
Error:
To solve this error, I tried to add the same comment
Thank you. I genuinely appreciate your support. Please let me know about your suggestion about the added comment line (whether it is correct or not). |
Beta Was this translation helpful? Give feedback.
-
@navidcy I already called this comment at the top of the script. However, I faced the same issue that I mentioned. |
Beta Was this translation helpful? Give feedback.
-
Let me try to run the script on GPU. |
Beta Was this translation helpful? Give feedback.
-
Please find the details below.
|
Beta Was this translation helpful? Give feedback.
-
Can you show the |
Beta Was this translation helpful? Give feedback.
-
Writing Taking a look at the script: https://github.com/CliMA/Oceananigans.jl/blob/main/examples/kelvin_helmholtz_instability.jl we see that there are calls to getindex in a few places: Wherever we write However, where we write But note that @sangeethasankar01 are you trying to get this to run on the GPU for some specific purpose? Or is this merely an educational exercise? I also think we should convert this issue to a discussion. I don't think we want to make these changes to the example in the source code. |
Beta Was this translation helpful? Give feedback.
-
I am a research scholar at IIT Madras, working under the supervision of Dr. Arjun Jagannathan. Currently, I'm exploring various problems related to flow instabilities. However, my current focus on this Kelvin-Helmholtz instability problem is purely for educational practice. I aim to understand the architecture of the code and optimize it for GPU execution. |
Beta Was this translation helpful? Give feedback.
-
I made the below changes only to enable this code to run on the GPU. Change:1
Change:2
Could you please review this and provide your suggestions? |
Beta Was this translation helpful? Give feedback.
-
Ideally you don't want (I'll convert this Issue into a Discussion btw.) |
Beta Was this translation helpful? Give feedback.
-
Btw, note that interior(b)[:, 1, ] induces scalar operations while interior(b, :, 1, :) does not. Similarly for other fields... With the above changes + insert of |
Beta Was this translation helpful? Give feedback.
-
@glwagner I am attempting to run the Kelvin-Helmholtz instability example on a GPU, but the model fails and throws errors. Can someone help me to sort out this error? Please find the attached error below:
Beta Was this translation helpful? Give feedback.
All reactions