Wrap all RTS functions exposed to AMPI programs in special macros
[charm.git] / src / arch / cuda / hybridAPI / hapi_functions.h
blob5be92d7248777e9e432d24b3463341d7a637f735
1 /*
2 * This file is separate from hapi.h because the Hybrid API is included as part
3 * of AMPI's extensions to the MPI standard, and certain global variable
4 * privatization methods require the AMPI API to be exposed as function pointers
5 * through a shim and loader mechanism that needs to list the entire set of
6 * provided functions at multiple points in its implementation.
8 * See src/libs/ck-libs/ampi/ampi_functions.h for mandatory procedures.
10 * For ease of reading: AMPI_CUSTOM_FUNC(ReturnType, FunctionName, Parameters...)
13 /******************** DEPRECATED ********************/
14 // Create a hapiWorkRequest object for the user. The runtime manages the associated
15 // memory, so the user only needs to set it up properly.
16 AMPI_CUSTOM_FUNC(hapiWorkRequest*, hapiCreateWorkRequest, void)
18 /******************** DEPRECATED ********************/
19 // Add a work request into the "queue". Currently all specified data transfers
20 // and kernel execution are directly put into a CUDA stream.
21 AMPI_CUSTOM_FUNC(void, hapiEnqueue, hapiWorkRequest* wr)
23 // The runtime queries the compute capability of the device, and creates as
24 // many streams as the maximum number of concurrent kernels.
25 AMPI_CUSTOM_FUNC(int, hapiCreateStreams, void)
27 // Get a CUDA stream that was created by the runtime. Current scheme is to
28 // hand out streams in a round-robin fashion.
29 AMPI_CUSTOM_FUNC(cudaStream_t, hapiGetStream, void)
31 // Add a Charm++ callback function to be invoked after the previous operation
32 // in the stream completes. This call should be placed after data transfers or
33 // a kernel invocation.
34 AMPI_CUSTOM_FUNC(void, hapiAddCallback, cudaStream_t, void*, void*)
36 // Thin wrappers for memory related CUDA API calls.
37 AMPI_CUSTOM_FUNC(cudaError_t, hapiMalloc, void**, size_t)
38 AMPI_CUSTOM_FUNC(cudaError_t, hapiFree, void*)
39 AMPI_CUSTOM_FUNC(cudaError_t, hapiMallocHost, void**, size_t)
40 AMPI_CUSTOM_FUNC(cudaError_t, hapiFreeHost, void*)
41 AMPI_CUSTOM_FUNC(cudaError_t, hapiMallocHostPool, void**, size_t)
42 AMPI_CUSTOM_FUNC(cudaError_t, hapiFreeHostPool, void*)
43 AMPI_CUSTOM_FUNC(cudaError_t, hapiMemcpyAsync, void*, const void*, size_t, enum cudaMemcpyKind, cudaStream_t)
45 // Explicit memory allocations using pinned memory pool.
46 AMPI_CUSTOM_FUNC(void*, hapiPoolMalloc, size_t)
47 AMPI_CUSTOM_FUNC(void, hapiPoolFree, void*)
49 // Provides support for detecting errors with CUDA API calls.
50 AMPI_CUSTOM_FUNC(void, hapiErrorDie, cudaError_t, const char*, const char*, int)
52 #ifdef HAPI_INSTRUMENT_WRS
53 AMPI_CUSTOM_FUNC(void, hapiInitInstrument, int n_chares, char n_types)
54 AMPI_CUSTOM_FUNC(hapiRequestTimeInfo*, hapiQueryInstrument, int chare, char type, char phase)
55 #endif