@Override public String toString() { return "<memory:" + getMemorySize() + ", vCores:" + getVirtualCores() + ", "+ "gpus:" + getGPUs() + ">"; } }
@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; }
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); }
@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; }
public void addResource(Resource res) { availableMB = availableMB + res.getMemorySize(); availableGB.incr((int)Math.floor(availableMB/1024d)); availableVCores.incr(res.getVirtualCores()); availableGPUs.incr(res.getGPUs()); }
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()); }
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()); }
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 : ");
int containerGPUs = containerResource.getGPUs(); HashSet<Device> deniedDevices = getGPUAllocator().allocate(containerName, containerGPUs);
@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)); }
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(); }
vmemLimitMBs = (int) (pmemLimitMBs * vmemRatio); cpuVcores = resource.getVirtualCores(); gpus = resource.getGPUs(); usageMetrics.recordResourceLimit( vmemLimitMBs, pmemLimitMBs, cpuVcores, gpus);
.getUsedResources().getMemorySize(); allocatedGpu = app.getApplicationResourceUsageReport() .getUsedResources().getGPUs();