Changes between Version 2 and Version 3 of Implementation_of_CUDA_in_CIVL


Ignore:
Timestamp:
03/16/22 14:45:44 (4 years ago)
Author:
Alex Wilton
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Implementation_of_CUDA_in_CIVL

    v2 v3  
    3737}
    3838}}}
    39 Here `$cuda_init()` simply creates the null stream of `$cuda_current_context` with the function `$cuda_stream_create()`. `$cuda_finalize()` waits for all kernels in all of its streams to finish completion, and then frees all memory relating to kernels and streams.
     39`$cuda_finalize()` waits for all kernels in all of its streams to finish completion, and then frees all memory relating to kernels and streams. `$cuda_init()` creates the null stream of `$cuda_current_context` with the function `$cuda_stream_create()`. The method `$cuda_stream_create()` mallocs a new stream, sets `usable` to true, and then adds a dummy `$cuda_kernel_instance_t` to the list with a finished status. The purpose of this dummy kernel is to simplify the logic in our library so that we don't need to check for an empty list each time we use a stream.
     40
     41Outside of this `main()` function, new streams are created with the CUDA library function `cudaStreamCreate(cudaStream_t* pStream)`. Our implementation of this function also calls `$cuda_stream_create()`, but it then adds this to the non-default stream list of `$cuda_current_context` and returns `cudaSuccess`.
     42
     43There are two primary actions one can do with a stream. One can wait on a stream (that is, wait until all kernels of the stream are finished) with the function `$cuda_stream_wait(cudaStream_t)`, or one can add a kernel instance to the stream with the function `$cuda_enqueue_kernel(cudaStream_t, (void ($cuda_kernel_instance_t*, cudaEvent_t)))`, however to explain the details of these functions we now need to learn more about how we emulate cuda kernels in CIVL.
     44
     45== CUDA Kernels ==