Workspace ID fix (#400)

Signed-off-by: raver119 <raver119@gmail.com>
master
raver119 2020-04-21 07:31:57 +03:00 committed by GitHub
parent 76aab75174
commit 5ee37a22eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -413,7 +413,7 @@ public class CudaWorkspace extends Nd4jWorkspace {
@Override
public String getUniqueId() {
return "Workspace_" + getId();
return "Workspace_" + getId() + "_" + Nd4j.getDeallocatorService().nextValue();
}
@Override

View File

@ -62,7 +62,7 @@ public class CpuWorkspace extends Nd4jWorkspace implements Deallocatable {
public String getUniqueId() {
return "Workspace_" + getId();
return "Workspace_" + getId() + "_" + Nd4j.getDeallocatorService().nextValue();
}
@Override
@ -93,9 +93,10 @@ public class CpuWorkspace extends Nd4jWorkspace implements Deallocatable {
isInit.set(true);
if (isDebug.get())
//if (isDebug.get())
log.info("Allocating [{}] workspace of {} bytes...", id, currentSize.get());
workspace.setHostPointer(new PagedPointer(memoryManager.allocate(currentSize.get() + SAFETY_OFFSET, MemoryKind.HOST, true)));
AllocationsTracker.getInstance().markAllocated(AllocationKind.WORKSPACE, 0, currentSize.get() + SAFETY_OFFSET);
}