Skip to content

Commit 83e8b3f

Browse files
committed
Add getter for cuda device allocator.
1 parent 4b0e3ee commit 83e8b3f

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

THCGeneral.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,11 @@ THAllocator* THCState_getCudaUVAAllocator(THCState* state)
293293
return state->cudaUVAAllocator;
294294
}
295295

296+
THC_API THCDeviceAllocator* THCState_getDeviceAllocator(THCState* state)
297+
{
298+
return state->cudaDeviceAllocator;
299+
}
300+
296301
void THCState_setDeviceAllocator(THCState* state, THCDeviceAllocator* allocator)
297302
{
298303
state->cudaDeviceAllocator = allocator;

THCGeneral.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ THC_API struct cudaDeviceProp* THCState_getCurrentDeviceProperties(THCState* sta
139139
THC_API struct THCRNGState* THCState_getRngState(THCState* state);
140140
THC_API THAllocator* THCState_getCudaHostAllocator(THCState* state);
141141
THC_API THAllocator* THCState_getCudaUVAAllocator(THCState* state);
142+
THC_API THCDeviceAllocator* THCState_getDeviceAllocator(THCState* state);
142143
THC_API void THCState_setDeviceAllocator(THCState* state, THCDeviceAllocator* allocator);
143144

144145
THC_API void THCMagma_init(THCState *state);

0 commit comments

Comments
 (0)