Skip to content

Noob question : avoid reuploading data between two kernel calls #692

Answered by inducer
mikamyara asked this question in Q&A
Discussion options

You must be logged in to vote

can I be sure that array2_g will not be uploaded again when k2 will be called ?

Yes. Even for array1_g, the copy happens on buffer creation and not thereafter.

I would like to know when exactly the code of k1 and k2 is run : is it at the moment at which k1 and k2 are queued, or is it when the outputs are downloaded ?

  • OpenCL does not define when the code runs as written.
  • If the transfers were not synchronous (as yours are) but instead enqueued (cl.enqueue_copy(..., is_blocking=False)), then the queue would guarantee execution in sequence.
  • If you would like to force the code to run, you could call queue.finish().

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mikamyara
Comment options

Answer selected by mikamyara
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants