public class GpuResourceAllocator extends Object
Constructor and Description |
---|
GpuResourceAllocator(Context ctx) |
Modifier and Type | Method and Description |
---|---|
void |
addGpu(GpuDevice gpuDevice)
Add GPU to allowed list
|
org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.gpu.GpuResourceAllocator.GpuAllocation |
assignGpus(Container container)
Assign GPU to requestor
|
void |
cleanupAssignGpus(org.apache.hadoop.yarn.api.records.ContainerId containerId)
Clean up all Gpus assigned to containerId
|
List<GpuDevice> |
getAllowedGpusCopy() |
List<AssignedGpuDevice> |
getAssignedGpusCopy() |
int |
getAvailableGpus() |
Map<GpuDevice,org.apache.hadoop.yarn.api.records.ContainerId> |
getDeviceAllocationMappingCopy() |
static int |
getRequestedGpus(org.apache.hadoop.yarn.api.records.Resource requestedResource)
Get number of requested GPUs from resource.
|
void |
recoverAssignedGpus(org.apache.hadoop.yarn.api.records.ContainerId containerId) |
public GpuResourceAllocator(Context ctx)
public void addGpu(GpuDevice gpuDevice)
gpuDevice
- gpu devicepublic int getAvailableGpus()
public void recoverAssignedGpus(org.apache.hadoop.yarn.api.records.ContainerId containerId) throws ResourceHandlerException
ResourceHandlerException
public static int getRequestedGpus(org.apache.hadoop.yarn.api.records.Resource requestedResource)
requestedResource
- requested resourcepublic org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.gpu.GpuResourceAllocator.GpuAllocation assignGpus(Container container) throws ResourceHandlerException
container
- container to allocateResourceHandlerException
- When failed to assign GPUs.public void cleanupAssignGpus(org.apache.hadoop.yarn.api.records.ContainerId containerId)
containerId
- containerIdpublic Map<GpuDevice,org.apache.hadoop.yarn.api.records.ContainerId> getDeviceAllocationMappingCopy()
public List<AssignedGpuDevice> getAssignedGpusCopy()
Copyright © 2020 Apache Software Foundation. All rights reserved.