| 1 |
|
|---|
| 2 | /* Functions in this file are meant to serve as drop-in CIVL replacements
|
|---|
| 3 | * for the Cuda function of the same name. Because of this, much of the
|
|---|
| 4 | * documentation of these functions is identical to the documentation
|
|---|
| 5 | * for its Cuda counterpart.
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #ifdef __CUDA_H__
|
|---|
| 9 | #else
|
|---|
| 10 | #define __CUDA_H__
|
|---|
| 11 |
|
|---|
| 12 | #include "cuda-types.cvh"
|
|---|
| 13 |
|
|---|
| 14 | /* Returns in *count the number of devices with compute capability
|
|---|
| 15 | * greater or equal to 1.0 that are available for execution.
|
|---|
| 16 | */
|
|---|
| 17 | cudaError_t cudaGetDeviceCount(int *count);
|
|---|
| 18 |
|
|---|
| 19 | /* Creates and event object
|
|---|
| 20 | */
|
|---|
| 21 | cudaError_t cudaEventCreate(cudaEvent_t *event);
|
|---|
| 22 |
|
|---|
| 23 | /* Records an event. If stream is non-zero, the event is recorded
|
|---|
| 24 | * after all preceding operations in stream have been completed;
|
|---|
| 25 | * otherwise, it is recorded after all preceding operations in the
|
|---|
| 26 | * CUDA context have been completed. Since operation is asynchronous,
|
|---|
| 27 | * cudaEventQuery() and/or cudaEventSynchronize() must be used to
|
|---|
| 28 | * determine when the event has actually been recorded.
|
|---|
| 29 | */
|
|---|
| 30 | cudaError_t cudaEventRecord(cudaEvent_t event, cudaStream_t s);
|
|---|
| 31 |
|
|---|
| 32 | /* Query the status of all device work preceding the most recent call
|
|---|
| 33 | * to cudaEventRecord() (in the appropriate compute streams, as
|
|---|
| 34 | * specified by the arguments to cudaEventRecord()).
|
|---|
| 35 | *
|
|---|
| 36 | * If this work has successfully been completed by the device, or if
|
|---|
| 37 | * cudaEventRecord() has not been called on event, then cudaSuccess
|
|---|
| 38 | * is returned. If this work has not yet been completed by the device
|
|---|
| 39 | * then cudaErrorNotReady is returned.
|
|---|
| 40 | */
|
|---|
| 41 | cudaError_t cudaEventQuery(cudaEvent_t event);
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 | /* Wait until the completion of all device work preceding the most
|
|---|
| 45 | * recent call to cudaEventRecord() (in the appropriate compute streams,
|
|---|
| 46 | * as specified by the arguments to cudaEventRecord()).
|
|---|
| 47 | *
|
|---|
| 48 | * If cudaEventRecord() has not been called on event, cudaSuccess
|
|---|
| 49 | * is returned immediately.
|
|---|
| 50 | */
|
|---|
| 51 | cudaError_t cudaEventSynchronize(cudaEvent_t event);
|
|---|
| 52 |
|
|---|
| 53 | /* since "timing" doesn't really make sense in the verification process
|
|---|
| 54 | * I'm not sure what this should do. maybe it shouldn't exist.
|
|---|
| 55 | */
|
|---|
| 56 | cudaError_t cudaEventElapsedTime(float *t, cudaEvent_t from, cudaEvent_t to);
|
|---|
| 57 |
|
|---|
| 58 | /* Destroys the event specified by event.
|
|---|
| 59 | */
|
|---|
| 60 | cudaError_t cudaEventDestroy(cudaEvent_t event);
|
|---|
| 61 |
|
|---|
| 62 | /* Creates a new asynchronous stream.
|
|---|
| 63 | */
|
|---|
| 64 | cudaError_t cudaStreamCreate(cudaStream_t *pStream);
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 | /* Blocks until stream has completed all operations.
|
|---|
| 68 | */
|
|---|
| 69 | cudaError_t cudaStreamSynchronize(cudaStream_t stream);
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 | /* Destroys and cleans up the asynchronous stream specified by stream.
|
|---|
| 73 | */
|
|---|
| 74 | cudaError_t cudaStreamDestroy(cudaStream_t pStream);
|
|---|
| 75 |
|
|---|
| 76 | /* locks until stream has completed all operations.
|
|---|
| 77 | */
|
|---|
| 78 | cudaError_t cudaDeviceSynchronize( void );
|
|---|
| 79 |
|
|---|
| 80 | /* Copies count bytes from the memory area pointed to by src to the
|
|---|
| 81 | * memory area pointed to by dst, where kind is one of
|
|---|
| 82 | * cudaMemcpyHostToHost, cudaMemcpyHostToDevice, cudaMemcpyDeviceToHost,
|
|---|
| 83 | * or cudaMemcpyDeviceToDevice, and specifies the direction of the
|
|---|
| 84 | * copy. The memory areas may not overlap.
|
|---|
| 85 | */
|
|---|
| 86 | cudaError_t cudaMemcpy ( void *dst, const void *src, size_t count, enum cudaMemcpyKind kind );
|
|---|
| 87 |
|
|---|
| 88 | /* Not implemented. Prototype provided for compatibilty purposes
|
|---|
| 89 | */
|
|---|
| 90 | cudaError_t cudaMalloc( void *ptr, size_t size);
|
|---|
| 91 |
|
|---|
| 92 | /* Frees the memory space pointed to by devPtr. Similar semantics to free/$free.
|
|---|
| 93 | */
|
|---|
| 94 | cudaError_t cudaFree(void *devPtr);
|
|---|
| 95 |
|
|---|
| 96 | /* Sets device as the current device for the calling host thread. Currently,
|
|---|
| 97 | * only a single device is supported, so this call always succeeds with a noop.
|
|---|
| 98 | */
|
|---|
| 99 | cudaError_t cudaSetDevice(int device_id);
|
|---|
| 100 |
|
|---|
| 101 | /* Not implemented. Prototype provided for compatibilty purposes
|
|---|
| 102 | */
|
|---|
| 103 | void __syncthreads( void );
|
|---|
| 104 |
|
|---|
| 105 | #endif
|
|---|