本文整理了Java中org.apache.hadoop.yarn.api.records.Resource.getGPUs
方法的一些代码示例,展示了Resource.getGPUs
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.getGPUs
方法的具体详情如下:
包路径:org.apache.hadoop.yarn.api.records.Resource
类名称:Resource
方法名:getGPUs
暂无
代码示例来源:origin: io.hops/hadoop-yarn-api
@Override
public String toString() {
return "<memory:" + getMemorySize() + ", vCores:" + getVirtualCores() + ", "+
"gpus:" + getGPUs() + ">";
}
}
代码示例来源:origin: io.hops/hadoop-yarn-api
@Override
public int hashCode() {
final int prime = 263167;
int result = (int) (939769357
+ getMemorySize()); // prime * result = 939769357 initially
result = prime * result + getVirtualCores();
result = prime * result + getGPUs();
return result;
}
代码示例来源:origin: io.hops/hadoop-yarn-client
static boolean canFit(Resource arg0, Resource arg1) {
long mem0 = arg0.getMemorySize();
long mem1 = arg1.getMemorySize();
long cpu0 = arg0.getVirtualCores();
long cpu1 = arg1.getVirtualCores();
int gpu0 = arg0.getGPUs();
int gpu1 = arg1.getGPUs();
return (mem0 <= mem1 && cpu0 <= cpu1 && gpu0 <= gpu1);
}
代码示例来源:origin: io.hops/hadoop-yarn-api
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Resource))
return false;
Resource other = (Resource) obj;
if (getMemorySize() != other.getMemorySize() ||
getVirtualCores() != other.getVirtualCores()||
getGPUs() != other.getGPUs()) {
return false;
}
return true;
}
代码示例来源:origin: io.hops/hadoop-yarn-server-nodemanager
public void addResource(Resource res) {
availableMB = availableMB + res.getMemorySize();
availableGB.incr((int)Math.floor(availableMB/1024d));
availableVCores.incr(res.getVirtualCores());
availableGPUs.incr(res.getGPUs());
}
代码示例来源:origin: io.hops/hadoop-yarn-server-nodemanager
public void releaseContainer(Resource res) {
allocatedContainers.decr();
allocatedMB = allocatedMB - res.getMemorySize();
allocatedGB.set((int)Math.ceil(allocatedMB/1024d));
availableMB = availableMB + res.getMemorySize();
availableGB.set((int)Math.floor(availableMB/1024d));
allocatedVCores.decr(res.getVirtualCores());
availableVCores.incr(res.getVirtualCores());
allocatedGPUs.decr(res.getGPUs());
availableGPUs.incr(res.getGPUs());
}
代码示例来源:origin: io.hops/hadoop-yarn-server-nodemanager
public void allocateContainer(Resource res) {
allocatedContainers.incr();
allocatedMB = allocatedMB + res.getMemorySize();
allocatedGB.set((int)Math.ceil(allocatedMB/1024d));
availableMB = availableMB - res.getMemorySize();
availableGB.set((int)Math.floor(availableMB/1024d));
allocatedVCores.incr(res.getVirtualCores());
availableVCores.decr(res.getVirtualCores());
allocatedGPUs.incr(res.getGPUs());
availableGPUs.decr(res.getGPUs());
}
代码示例来源:origin: io.hops/hadoop-yarn-client
nodeReportStr.print("\tGPU-Used : ");
nodeReportStr.println((nodeReport.getUsed() == null) ? "0 gpus"
: (nodeReport.getUsed().getGPUs() + " gpus"));
nodeReportStr.print("\tGPU-Capacity : ");
nodeReportStr.println(nodeReport.getCapability().getGPUs() + " " +
"gpus");
nodeReportStr.print("\tNode-Labels : ");
代码示例来源:origin: io.hops/hadoop-yarn-server-nodemanager
int containerGPUs = containerResource.getGPUs();
HashSet<Device> deniedDevices =
getGPUAllocator().allocate(containerName, containerGPUs);
代码示例来源:origin: io.hops/hadoop-yarn-server-nodemanager
@SuppressWarnings("unchecked") // dispatcher not typed
private void sendContainerMonitorStartEvent() {
long launchDuration = clock.getTime() - containerLaunchStartTime;
metrics.addContainerLaunchDuration(launchDuration);
long pmemBytes = getResource().getMemorySize() * 1024 * 1024L;
float pmemRatio = daemonConf.getFloat(
YarnConfiguration.NM_VMEM_PMEM_RATIO,
YarnConfiguration.DEFAULT_NM_VMEM_PMEM_RATIO);
long vmemBytes = (long) (pmemRatio * pmemBytes);
int cpuVcores = getResource().getVirtualCores();
int gpus = getResource().getGPUs();
long localizationDuration = containerLaunchStartTime -
containerLocalizationStartTime;
dispatcher.getEventHandler().handle(
new ContainerStartMonitoringEvent(containerId,
vmemBytes, pmemBytes, cpuVcores, gpus, launchDuration,
localizationDuration));
}
代码示例来源:origin: io.hops/hadoop-yarn-server-common
public ContainerInfo(ContainerReport container) {
containerId = container.getContainerId().toString();
if (container.getAllocatedResource() != null) {
allocatedMB = container.getAllocatedResource().getMemorySize();
allocatedVCores = container.getAllocatedResource().getVirtualCores();
allocatedGPUs = container.getAllocatedResource().getGPUs();
}
if (container.getAssignedNode() != null) {
assignedNodeId = container.getAssignedNode().toString();
}
priority = container.getPriority().getPriority();
startedTime = container.getCreationTime();
finishedTime = container.getFinishTime();
elapsedTime = Times.elapsed(startedTime, finishedTime);
diagnosticsInfo = container.getDiagnosticsInfo();
logUrl = container.getLogUrl();
containerExitStatus = container.getContainerExitStatus();
containerState = container.getContainerState();
nodeHttpAddress = container.getNodeHttpAddress();
}
代码示例来源:origin: io.hops/hadoop-yarn-server-nodemanager
vmemLimitMBs = (int) (pmemLimitMBs * vmemRatio);
cpuVcores = resource.getVirtualCores();
gpus = resource.getGPUs();
usageMetrics.recordResourceLimit(
vmemLimitMBs, pmemLimitMBs, cpuVcores, gpus);
代码示例来源:origin: io.hops/hadoop-yarn-server-common
.getUsedResources().getMemorySize();
allocatedGpu = app.getApplicationResourceUsageReport()
.getUsedResources().getGPUs();
内容来源于网络,如有侵权,请联系作者删除!