Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GPU memory usage #1032

Merged
merged 1 commit into from
Sep 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ public interface ProcDao {
* @param maxKb
*/
void updateProcMemoryUsage(FrameInterface f, long rss, long maxRss,
long vsize, long maxVsize);
long vsize, long maxVsize,
long usedGpuMemory, long maxUsedGpuMemory);

/**
* get aq virual proc from its unique id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,15 @@ public boolean clearVirtualProcAssignment(FrameInterface frame) {
"int_mem_max_used = ?," +
"int_virt_used = ?, " +
"int_virt_max_used = ?, " +
"int_gpu_mem_used = ?, " +
"int_gpu_mem_max_used = ?, " +
"ts_ping = current_timestamp " +
"WHERE " +
"pk_frame = ?";

@Override
public void updateProcMemoryUsage(FrameInterface f, long rss, long maxRss,
long vss, long maxVss) {
long vss, long maxVss, long usedGpuMemory, long maxUsedGpuMemory) {
/*
* This method is going to repeat for a proc every 1 minute, so
* if the proc is being touched by another thread, then return
Expand All @@ -256,7 +258,8 @@ public void updateProcMemoryUsage(FrameInterface f, long rss, long maxRss,
String.class, f.getFrameId()).equals(f.getFrameId())) {

getJdbcTemplate().update(UPDATE_PROC_MEMORY_USAGE,
rss, maxRss, vss, maxVss, f.getFrameId());
rss, maxRss, vss, maxVss,
usedGpuMemory, maxUsedGpuMemory, f.getFrameId());
}
} catch (DataAccessException dae) {
logger.info("The proc for frame " + f +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,11 @@ List<DispatchFrame> findNextDispatchFrames(LayerInterface layer, VirtualProc pro
* @param maxRss
* @param vsize
* @param maxVsize
* @param usedGpuMemory
* @param maxUsedGpuMemory
*/
void updateProcMemoryUsage(FrameInterface frame, long rss, long maxRss, long vsize,
long maxVsize);
long maxVsize, long usedGpuMemory, long maxUsedGpuMemory);

/**
* Return true if adding the given core units would put the show
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,10 @@ public void lostProc(VirtualProc proc, String reason, int exitStatus) {
@Override
@Transactional(propagation = Propagation.REQUIRED)
public void updateProcMemoryUsage(FrameInterface frame, long rss, long maxRss,
long vsize, long maxVsize) {
procDao.updateProcMemoryUsage(frame, rss, maxRss, vsize, maxVsize);
long vsize, long maxVsize,
long usedGpuMemory, long maxUsedGpuMemory) {
procDao.updateProcMemoryUsage(frame, rss, maxRss, vsize, maxVsize,
usedGpuMemory, maxUsedGpuMemory);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,8 @@ private void updateMemoryUsage(List<RunningFrameInfo> rFrames) {
rf.getRss(), rf.getMaxRss());

dispatchSupport.updateProcMemoryUsage(frame,
rf.getRss(), rf.getMaxRss(), rf.getVsize(), rf.getMaxVsize());
rf.getRss(), rf.getMaxRss(), rf.getVsize(), rf.getMaxVsize(),
rf.getUsedGpuMemory(), rf.getMaxUsedGpuMemory());
}

updateJobMemoryUsage(rFrames);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ public void testUpdateProcMemoryUsage() {
procDao.insertVirtualProc(proc);
procDao.verifyRunningProc(proc.getId(), frame.getId());

procDao.updateProcMemoryUsage(frame, 100, 100, 1000, 1000);
procDao.updateProcMemoryUsage(frame, 100, 100, 1000, 1000, 0, 0);

}

Expand Down Expand Up @@ -593,7 +593,7 @@ public void testFindReservedMemoryOffender() {

// Increase the memory usage as frames are added
procDao.updateProcMemoryUsage(frame,
1000*i, 1000*i, 1000*i, 1000*i);
1000*i, 1000*i, 1000*i, 1000*i, 0, 0);
i++;
}

Expand Down Expand Up @@ -666,7 +666,7 @@ public void testBalanceUnderUtilizedProcs() {
proc1.frameId = frame1.id;
procDao.insertVirtualProc(proc1);

procDao.updateProcMemoryUsage(frame1, 250000, 250000, 250000, 250000);
procDao.updateProcMemoryUsage(frame1, 250000, 250000, 250000, 250000, 0, 0);
layerDao.updateLayerMaxRSS(frame1, 250000, true);

FrameDetail frameDetail2 = frameDao.findFrameDetail(job, "0002-pass_1");
Expand All @@ -676,7 +676,7 @@ public void testBalanceUnderUtilizedProcs() {
proc2.frameId = frame2.id;
procDao.insertVirtualProc(proc2);

procDao.updateProcMemoryUsage(frame2, 255000, 255000,255000, 255000);
procDao.updateProcMemoryUsage(frame2, 255000, 255000,255000, 255000, 0, 0);
layerDao.updateLayerMaxRSS(frame2, 255000, true);

FrameDetail frameDetail3 = frameDao.findFrameDetail(job, "0003-pass_1");
Expand All @@ -686,7 +686,7 @@ public void testBalanceUnderUtilizedProcs() {
proc3.frameId = frame3.id;
procDao.insertVirtualProc(proc3);

procDao.updateProcMemoryUsage(frame3, 3145728, 3145728,3145728, 3145728);
procDao.updateProcMemoryUsage(frame3, 3145728, 3145728,3145728, 3145728, 0, 0);
layerDao.updateLayerMaxRSS(frame3,300000, true);

procDao.balanceUnderUtilizedProcs(proc3, 100000);
Expand Down