Changeset 22f928f
- Timestamp:
- 05/31/15 09:46:11 (10 years ago)
- Branches:
- master
- Children:
- 4598848
- Parents:
- a7b97b9
- git-author:
- Hal Finkel <hfinkel@…> (05/31/15 09:46:11)
- git-committer:
- Hal Finkel <hfinkel@…> (05/31/15 09:46:11)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
README
r24aa734 r22f928f 36 36 in textual form. 37 37 38 When running under common batch systems, the files are named 39 JOB_ID.HOST.PID.memlog, and when running under the BG/Q CNK, the process's rank 40 is used instead of the node-local PID. 41 38 42 Note that te peak memory usage is determined by monitoring the processes's 39 43 maximum resident set size, not just the total allocated heap memory. -
memlog.cpp
ra7b97b9 r22f928f 37 37 // -Wl,--wrap,malloc,--wrap,free,--wrap,realloc,--wrap,calloc,--wrap,memalign /path/to/memlog_s.o -lpthread -ldl 38 38 39 FILE *log_file = NULL;39 FILE *log_file = 0; 40 40 static pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER; 41 41 … … 58 58 #endif 59 59 60 // If we're running under a common batch system, add the job id to the output 61 // file names (add it as a prefix so that sorting the files will sort by job 62 // first). 63 char *job_id = 0; 64 const char *job_id_vars[] = 65 { "COBALT_JOBID", "PBS_JOBID", "SLURM_JOB_ID", "JOB_ID" }; 66 for (int i = 0; i < sizeof(job_id_vars)/sizeof(job_id_vars[0]); ++i) { 67 job_id = getenv(job_id_vars[i]); 68 if (job_id) 69 break; 70 } 71 60 72 char log_name[PATH_MAX+1]; 61 snprintf(log_name, PATH_MAX+1, "%s.%d.memlog", u.nodename, id); 73 if (job_id) 74 snprintf(log_name, PATH_MAX+1, "%s.%s.%d.memlog", job_id, u.nodename, id); 75 else 76 snprintf(log_name, PATH_MAX+1, "%s.%d.memlog", u.nodename, id); 62 77 log_file = fopen(log_name, "w"); 63 78 if (!log_file)
Note: See TracChangeset
for help on using the changeset viewer.