Skip to content

opal/accelerator: implement additional stub APIs #12091

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions opal/mca/accelerator/cuda/accelerator_cuda.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@
/* Accelerator API's */
static int accelerator_cuda_check_addr(const void *addr, int *dev_id, uint64_t *flags);
static int accelerator_cuda_create_stream(int dev_id, opal_accelerator_stream_t **stream);
static int accelerator_cuda_destroy_stream(opal_accelerator_stream_t *stream);
static int accelerator_cuda_synchronize_stream(opal_accelerator_stream_t *stream);
static int accelerator_cuda_stream_wait_event(opal_accelerator_stream_t *stream,
opal_accelerator_event_t *event);

static int accelerator_cuda_create_event(int dev_id, opal_accelerator_event_t **event);
static int accelerator_cuda_destroy_event(opal_accelerator_event_t *event);
static int accelerator_cuda_record_event(int dev_id, opal_accelerator_event_t *event, opal_accelerator_stream_t *stream);
static int accelerator_cuda_query_event(int dev_id, opal_accelerator_event_t *event);

Expand All @@ -41,6 +46,17 @@ static int accelerator_cuda_mem_release(int dev_id, void *ptr);
static int accelerator_cuda_get_address_range(int dev_id, const void *ptr, void **base,
size_t *size);

static bool accelerator_cuda_is_ipc_enabled(void);
static int accelerator_cuda_get_ipc_handle(int dev_id, void *dev_ptr,
opal_accelerator_ipc_handle_t *handle);
static int accelerator_cuda_open_ipc_handle(int dev_id, opal_accelerator_ipc_handle_t *handle,
void **dev_ptr);
static int accelerator_cuda_get_ipc_event_handle(opal_accelerator_event_t *event,
opal_accelerator_ipc_event_handle_t *handle);
static int accelerator_cuda_open_ipc_event_handle(opal_accelerator_ipc_event_handle_t *handle,
opal_accelerator_event_t *event);
static int accelerator_cuda_close_ipc_handle(int dev_id, void *dev_ptr);

static int accelerator_cuda_host_register(int dev_id, void *ptr, size_t size);
static int accelerator_cuda_host_unregister(int dev_id, void *ptr);

Expand All @@ -55,8 +71,12 @@ opal_accelerator_base_module_t opal_accelerator_cuda_module =
accelerator_cuda_check_addr,

accelerator_cuda_create_stream,
accelerator_cuda_destroy_stream,
accelerator_cuda_synchronize_stream,
accelerator_cuda_stream_wait_event,

accelerator_cuda_create_event,
accelerator_cuda_destroy_event,
accelerator_cuda_record_event,
accelerator_cuda_query_event,

Expand All @@ -67,6 +87,13 @@ opal_accelerator_base_module_t opal_accelerator_cuda_module =
accelerator_cuda_mem_release,
accelerator_cuda_get_address_range,

accelerator_cuda_is_ipc_enabled,
accelerator_cuda_get_ipc_handle,
accelerator_cuda_open_ipc_handle,
accelerator_cuda_get_ipc_event_handle,
accelerator_cuda_open_ipc_event_handle,
accelerator_cuda_close_ipc_handle,

accelerator_cuda_host_register,
accelerator_cuda_host_unregister,

Expand Down Expand Up @@ -254,6 +281,23 @@ static void opal_accelerator_cuda_stream_destruct(opal_accelerator_cuda_stream_t
}
}

static int accelerator_cuda_destroy_stream(opal_accelerator_stream_t *stream)
{
opal_accelerator_cuda_stream_destruct(stream);
return OPAL_SUCCESS;
}

static int accelerator_cuda_synchronize_stream(opal_accelerator_stream_t *stream)
{
return OPAL_ERR_NOT_IMPLEMENTED;
}

static int accelerator_cuda_stream_wait_event(opal_accelerator_stream_t *stream,
opal_accelerator_event_t *event)
{
return OPAL_ERR_NOT_IMPLEMENTED;
}

OBJ_CLASS_INSTANCE(
opal_accelerator_cuda_stream_t,
opal_accelerator_stream_t,
Expand Down Expand Up @@ -302,6 +346,12 @@ static void opal_accelerator_cuda_event_destruct(opal_accelerator_cuda_event_t *
}
}

static int accelerator_cuda_destroy_event(opal_accelerator_event_t *event)
{
opal_accelerator_cuda_event_destruct(event);
return OPAL_SUCCESS;
}

OBJ_CLASS_INSTANCE(
opal_accelerator_cuda_event_t,
opal_accelerator_event_t,
Expand Down Expand Up @@ -520,6 +570,40 @@ static int accelerator_cuda_get_address_range(int dev_id, const void *ptr, void
return 0;
}

static bool accelerator_null_is_ipc_enabled(void)
{
return false;
}

static int accelerator_cuda_get_ipc_handle(int dev_id, void *dev_ptr,
opal_accelerator_ipc_handle_t *handle)
{
return OPAL_ERR_NOT_IMPLEMENTED;
}

static int accelerator_cuda_open_ipc_handle(int dev_id, opal_accelerator_ipc_handle_t *handle,
void **dev_ptr)
{
return OPAL_ERR_NOT_IMPLEMENTED;
}

static int accelerator_cuda_get_ipc_event_handle(opal_accelerator_event_t *event,
opal_accelerator_ipc_event_handle_t *handle)
{
return OPAL_ERR_NOT_IMPLEMENTED;
}

static int accelerator_cuda_open_ipc_event_handle(opal_accelerator_ipc_event_handle_t *handle,
opal_accelerator_event_t *event)
{
return OPAL_ERR_NOT_IMPLEMENTED;
}

static int accelerator_cuda_close_ipc_handle(int dev_id, void *dev_ptr)
{
return OPAL_ERR_NOT_IMPLEMENTED;
}

static int accelerator_cuda_host_register(int dev_id, void *ptr, size_t size)
{
CUresult result;
Expand Down
84 changes: 84 additions & 0 deletions opal/mca/accelerator/null/accelerator_null_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ static void accelerator_null_finalize(opal_accelerator_base_module_t* module);
static int accelerator_null_check_addr(const void *addr, int *dev_id, uint64_t *flags);

static int accelerator_null_create_stream(int dev_id, opal_accelerator_stream_t **stream);
static int accelerator_null_destroy_stream(opal_accelerator_stream_t *stream);
static int accelerator_null_synchronize_stream(opal_accelerator_stream_t *stream);
static int accelerator_null_stream_wait_event(opal_accelerator_stream_t *stream,
opal_accelerator_event_t *event);
static int accelerator_null_create_event(int dev_id, opal_accelerator_event_t **event);
static int accelerator_null_destroy_event(opal_accelerator_event_t *event);
static int accelerator_null_record_event(int dev_id, opal_accelerator_event_t *event, opal_accelerator_stream_t *stream);
static int accelerator_null_query_event(int dev_id, opal_accelerator_event_t *event);

Expand All @@ -55,6 +60,17 @@ static int accelerator_null_mem_alloc(int dev_id, void **ptr, size_t size);
static int accelerator_null_mem_release(int dev_id, void *ptr);
static int accelerator_null_get_address_range(int dev_id, const void *ptr, void **base, size_t *size);

static bool accelerator_null_is_ipc_enabled(void);
static int accelerator_null_get_ipc_handle(int dev_id, void *dev_ptr,
opal_accelerator_ipc_handle_t *handle);
static int accelerator_null_open_ipc_handle(int dev_id, opal_accelerator_ipc_handle_t *handle,
void **dev_ptr);
static int accelerator_null_get_ipc_event_handle(opal_accelerator_event_t *event,
opal_accelerator_ipc_event_handle_t *handle);
static int accelerator_null_open_ipc_event_handle(opal_accelerator_ipc_event_handle_t *handle,
opal_accelerator_event_t *event);
static int accelerator_null_close_ipc_handle(int dev_id, void *dev_ptr);

static int accelerator_null_host_register(int dev_id, void *ptr, size_t size);
static int accelerator_null_host_unregister(int dev_id, void *ptr);

Expand Down Expand Up @@ -107,8 +123,12 @@ opal_accelerator_base_module_t opal_accelerator_null_module =
accelerator_null_check_addr,

accelerator_null_create_stream,
accelerator_null_destroy_stream,
accelerator_null_synchronize_stream,
accelerator_null_stream_wait_event,

accelerator_null_create_event,
accelerator_null_destroy_event,
accelerator_null_record_event,
accelerator_null_query_event,

Expand All @@ -119,6 +139,13 @@ opal_accelerator_base_module_t opal_accelerator_null_module =
accelerator_null_mem_release,
accelerator_null_get_address_range,

accelerator_null_is_ipc_enabled,
accelerator_null_get_ipc_handle,
accelerator_null_open_ipc_handle,
accelerator_null_get_ipc_event_handle,
accelerator_null_open_ipc_event_handle,
accelerator_null_close_ipc_handle,

accelerator_null_host_register,
accelerator_null_host_unregister,

Expand Down Expand Up @@ -167,12 +194,35 @@ static int accelerator_null_create_stream(int dev_id, opal_accelerator_stream_t
return OPAL_SUCCESS;
}

static int accelerator_null_destroy_stream(opal_accelerator_stream_t *stream)
{
OBJ_RELEASE(stream);
return OPAL_SUCCESS;
}

static int accelerator_null_synchronize_stream(opal_accelerator_stream_t *stream)
{
return OPAL_SUCCESS;
}

static int accelerator_null_stream_wait_event(opal_accelerator_stream_t *stream,
opal_accelerator_event_t *event)
{
return OPAL_SUCCESS;
}

static int accelerator_null_create_event(int dev_id, opal_accelerator_event_t **event)
{
*event = OBJ_NEW(opal_accelerator_event_t);
return OPAL_SUCCESS;
}

static int accelerator_null_destroy_event(opal_accelerator_event_t *event)
{
OBJ_RELEASE(event);
return OPAL_SUCCESS;
}

static int accelerator_null_record_event(int dev_id, opal_accelerator_event_t *event, opal_accelerator_stream_t *stream)
{
return OPAL_SUCCESS;
Expand Down Expand Up @@ -222,6 +272,40 @@ static int accelerator_null_get_address_range(int dev_id, const void *ptr, void
return OPAL_ERR_NOT_IMPLEMENTED;
}

static bool accelerator_null_is_ipc_enabled(void)
{
return false;
}

static int accelerator_null_get_ipc_handle(int dev_id, void *dev_ptr,
opal_accelerator_ipc_handle_t *handle)
{
return OPAL_ERR_NOT_IMPLEMENTED;
}

static int accelerator_null_open_ipc_handle(int dev_id, opal_accelerator_ipc_handle_t *handle,
void **dev_ptr)
{
return OPAL_ERR_NOT_IMPLEMENTED;
}

static int accelerator_null_get_ipc_event_handle(opal_accelerator_event_t *event,
opal_accelerator_ipc_event_handle_t *handle)
{
return OPAL_ERR_NOT_IMPLEMENTED;
}

static int accelerator_null_open_ipc_event_handle(opal_accelerator_ipc_event_handle_t *handle,
opal_accelerator_event_t *event)
{
return OPAL_ERR_NOT_IMPLEMENTED;
}

static int accelerator_null_close_ipc_handle(int dev_id, void *dev_ptr)
{
return OPAL_ERR_NOT_IMPLEMENTED;
}

static int accelerator_null_host_register(int dev_id, void *ptr, size_t size)
{
return OPAL_ERR_NOT_IMPLEMENTED;
Expand Down
Loading