Skip to content

Commit 5e5bacd

Browse files
authored
Merge pull request #10856 from wckzhang/renameacc
opal/accelerator: Rename malloc/free functions
2 parents 838556a + f880fd9 commit 5e5bacd

File tree

6 files changed

+27
-27
lines changed

6 files changed

+27
-27
lines changed

ompi/mca/mtl/base/mtl_base_datatype.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ ompi_mtl_datatype_pack(struct opal_convertor_t *convertor,
6868
iov.iov_base = malloc(*buffer_len);
6969
/* The remaining case is if this is an accelerator buffer and we have accelerator support and we need buffers. We will need to do an accelerator malloc*/
7070
} else {
71-
opal_accelerator.malloc(MCA_ACCELERATOR_NO_DEVICE_ID, &iov.iov_base, *buffer_len);
71+
opal_accelerator.mem_alloc(MCA_ACCELERATOR_NO_DEVICE_ID, &iov.iov_base, *buffer_len);
7272
}
7373

7474
if (NULL == iov.iov_base) return OMPI_ERR_OUT_OF_RESOURCE;
@@ -103,7 +103,7 @@ ompi_mtl_datatype_recv_buf(struct opal_convertor_t *convertor,
103103
*buffer = malloc(*buffer_len);
104104
/* The remaining case is if this is an accelerator buffer and we have accelerator support and we need buffers. Wwe will need to do an accelerator malloc*/
105105
} else {
106-
opal_accelerator.malloc(MCA_ACCELERATOR_NO_DEVICE_ID, buffer, *buffer_len);
106+
opal_accelerator.mem_alloc(MCA_ACCELERATOR_NO_DEVICE_ID, buffer, *buffer_len);
107107
}
108108

109109
if (NULL == *buffer) return OMPI_ERR_OUT_OF_RESOURCE;
@@ -132,7 +132,7 @@ ompi_mtl_datatype_unpack(struct opal_convertor_t *convertor,
132132
opal_convertor_unpack(convertor, &iov, &iov_count, &buffer_len);
133133
/* If it's an accelerator buffer and we have accelerator support, we will need to free the accelerator buffer */
134134
if (is_accelerator && true == ompi_mtl_base_selected_component->accelerator_support) {
135-
opal_accelerator.free(MCA_ACCELERATOR_NO_DEVICE_ID, buffer);
135+
opal_accelerator.mem_release(MCA_ACCELERATOR_NO_DEVICE_ID, buffer);
136136
/* If it's not an accelerator buffer or we don't have accelerator support, we will need to free the host buffer */
137137
} else {
138138
free(buffer);

ompi/mca/mtl/ofi/mtl_ofi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ int ompi_mtl_ofi_deregister_and_free_buffer(ompi_mtl_ofi_request_t *ofi_req) {
382382
free(ofi_req->buffer);
383383
/* The buffer must be an accelerator buffer */
384384
} else {
385-
ret = opal_accelerator.free(MCA_ACCELERATOR_NO_DEVICE_ID, ofi_req->buffer);
385+
ret = opal_accelerator.mem_release(MCA_ACCELERATOR_NO_DEVICE_ID, ofi_req->buffer);
386386
}
387387
}
388388
ofi_req->buffer = NULL;

opal/mca/accelerator/accelerator.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,12 @@ typedef int (*opal_accelerator_base_module_memmove_fn_t)(
274274
*
275275
* @return OPAL_SUCCESS or error status on failure
276276
*/
277-
typedef int (*opal_accelerator_base_module_malloc_fn_t)(
277+
typedef int (*opal_accelerator_base_module_mem_alloc_fn_t)(
278278
int dev_id, void **ptr, size_t size);
279279

280280
/**
281281
* Frees the memory space pointed to by ptr which has been returned by
282-
* a previous call to an opal_accelerator_base_module_malloc_fn_t().
282+
* a previous call to an opal_accelerator_base_module_mem_alloc_fn_t().
283283
* If the function is called on a ptr that has already been freed,
284284
* undefined behavior occurs. If ptr is NULL, no operation is performed,
285285
* and the function returns OPAL_SUCCESS.
@@ -290,7 +290,7 @@ typedef int (*opal_accelerator_base_module_malloc_fn_t)(
290290
*
291291
* @return OPAL_SUCCESS or error status on failure
292292
*/
293-
typedef int (*opal_accelerator_base_module_free_fn_t)(
293+
typedef int (*opal_accelerator_base_module_mem_release_fn_t)(
294294
int dev_id, void *ptr);
295295

296296
/**
@@ -375,8 +375,8 @@ typedef struct {
375375
opal_accelerator_base_module_memcpy_fn_t memcpy;
376376
opal_accelerator_base_module_memmove_fn_t memmove;
377377

378-
opal_accelerator_base_module_malloc_fn_t malloc;
379-
opal_accelerator_base_module_free_fn_t free;
378+
opal_accelerator_base_module_mem_alloc_fn_t mem_alloc;
379+
opal_accelerator_base_module_mem_release_fn_t mem_release;
380380
opal_accelerator_base_module_get_address_range_fn_t get_address_range;
381381

382382
opal_accelerator_base_module_host_register_fn_t host_register;

opal/mca/accelerator/cuda/accelerator_cuda.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ static int accelerator_cuda_memcpy(int dest_dev_id, int src_dev_id, void *dest,
3636
size_t size, opal_accelerator_transfer_type_t type);
3737
static int accelerator_cuda_memmove(int dest_dev_id, int src_dev_id, void *dest, const void *src, size_t size,
3838
opal_accelerator_transfer_type_t type);
39-
static int accelerator_cuda_malloc(int dev_id, void **ptr, size_t size);
40-
static int accelerator_cuda_free(int dev_id, void *ptr);
39+
static int accelerator_cuda_mem_alloc(int dev_id, void **ptr, size_t size);
40+
static int accelerator_cuda_mem_release(int dev_id, void *ptr);
4141
static int accelerator_cuda_get_address_range(int dev_id, const void *ptr, void **base,
4242
size_t *size);
4343

@@ -60,8 +60,8 @@ opal_accelerator_base_module_t opal_accelerator_cuda_module =
6060
accelerator_cuda_memcpy_async,
6161
accelerator_cuda_memcpy,
6262
accelerator_cuda_memmove,
63-
accelerator_cuda_malloc,
64-
accelerator_cuda_free,
63+
accelerator_cuda_mem_alloc,
64+
accelerator_cuda_mem_release,
6565
accelerator_cuda_get_address_range,
6666

6767
accelerator_cuda_host_register,
@@ -417,7 +417,7 @@ static int accelerator_cuda_memmove(int dest_dev_id, int src_dev_id, void *dest,
417417
return OPAL_SUCCESS;
418418
}
419419

420-
static int accelerator_cuda_malloc(int dev_id, void **ptr, size_t size)
420+
static int accelerator_cuda_mem_alloc(int dev_id, void **ptr, size_t size)
421421
{
422422
CUresult result;
423423

@@ -436,7 +436,7 @@ static int accelerator_cuda_malloc(int dev_id, void **ptr, size_t size)
436436
return 0;
437437
}
438438

439-
static int accelerator_cuda_free(int dev_id, void *ptr)
439+
static int accelerator_cuda_mem_release(int dev_id, void *ptr)
440440
{
441441
CUresult result;
442442
if (NULL != ptr) {

opal/mca/accelerator/null/accelerator_null_component.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ static int accelerator_null_memcpy(int dest_dev_id, int src_dev_id, void *dest,
5151
static int accelerator_null_memmove(int dest_dev_id, int src_dev_id, void *dest, const void *src, size_t size,
5252
opal_accelerator_transfer_type_t type);
5353

54-
static int accelerator_null_malloc(int dev_id, void **ptr, size_t size);
55-
static int accelerator_null_free(int dev_id, void *ptr);
54+
static int accelerator_null_mem_alloc(int dev_id, void **ptr, size_t size);
55+
static int accelerator_null_mem_release(int dev_id, void *ptr);
5656
static int accelerator_null_get_address_range(int dev_id, const void *ptr, void **base, size_t *size);
5757

5858
static int accelerator_null_host_register(int dev_id, void *ptr, size_t size);
@@ -112,8 +112,8 @@ opal_accelerator_base_module_t opal_accelerator_null_module =
112112
accelerator_null_memcpy_async,
113113
accelerator_null_memcpy,
114114
accelerator_null_memmove,
115-
accelerator_null_malloc,
116-
accelerator_null_free,
115+
accelerator_null_mem_alloc,
116+
accelerator_null_mem_release,
117117
accelerator_null_get_address_range,
118118

119119
accelerator_null_host_register,
@@ -198,13 +198,13 @@ static int accelerator_null_memmove(int dest_dev_id, int src_dev_id, void *dest,
198198
return OPAL_SUCCESS;
199199
}
200200

201-
static int accelerator_null_malloc(int dev_id, void **ptr, size_t size)
201+
static int accelerator_null_mem_alloc(int dev_id, void **ptr, size_t size)
202202
{
203203
*ptr = malloc(size);
204204
return OPAL_SUCCESS;
205205
}
206206

207-
static int accelerator_null_free(int dev_id, void *ptr)
207+
static int accelerator_null_mem_release(int dev_id, void *ptr)
208208
{
209209
free(ptr);
210210
return OPAL_SUCCESS;

opal/mca/accelerator/rocm/accelerator_rocm_module.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ static int mca_accelerator_rocm_memcpy(int dest_dev_id, int src_dev_id, void *de
2626
size_t size, opal_accelerator_transfer_type_t type);
2727
static int mca_accelerator_rocm_memmove(int dest_dev_id, int src_dev_id, void *dest, const void *src, size_t size,
2828
opal_accelerator_transfer_type_t type);
29-
static int mca_accelerator_rocm_malloc(int dev_id, void **ptr, size_t size);
30-
static int mca_accelerator_rocm_free(int dev_id, void *ptr);
29+
static int mca_accelerator_rocm_mem_alloc(int dev_id, void **ptr, size_t size);
30+
static int mca_accelerator_rocm_mem_release(int dev_id, void *ptr);
3131
static int mca_accelerator_rocm_get_address_range(int dev_id, const void *ptr, void **base,
3232
size_t *size);
3333

@@ -51,8 +51,8 @@ opal_accelerator_base_module_t opal_accelerator_rocm_module =
5151
mca_accelerator_rocm_memcpy_async,
5252
mca_accelerator_rocm_memcpy,
5353
mca_accelerator_rocm_memmove,
54-
mca_accelerator_rocm_malloc,
55-
mca_accelerator_rocm_free,
54+
mca_accelerator_rocm_mem_alloc,
55+
mca_accelerator_rocm_mem_release,
5656
mca_accelerator_rocm_get_address_range,
5757

5858
mca_accelerator_rocm_host_register,
@@ -364,7 +364,7 @@ static int mca_accelerator_rocm_memmove(int dest_dev_id, int src_dev_id, void *d
364364
return OPAL_SUCCESS;
365365
}
366366

367-
static int mca_accelerator_rocm_malloc(int dev_id, void **ptr, size_t size)
367+
static int mca_accelerator_rocm_mem_alloc(int dev_id, void **ptr, size_t size)
368368
{
369369
if (NULL == ptr || size <= 0) {
370370
return OPAL_ERR_BAD_PARAM;
@@ -380,7 +380,7 @@ static int mca_accelerator_rocm_malloc(int dev_id, void **ptr, size_t size)
380380
return OPAL_SUCCESS;
381381
}
382382

383-
static int mca_accelerator_rocm_free(int dev_id, void *ptr)
383+
static int mca_accelerator_rocm_mem_release(int dev_id, void *ptr)
384384
{
385385
if (NULL == ptr) {
386386
return OPAL_ERR_BAD_PARAM;

0 commit comments

Comments
 (0)