From 0d2a253ea20415ff22479e752a112c270e9aa48f Mon Sep 17 00:00:00 2001 From: Nathan Baltzell Date: Thu, 15 Oct 2026 16:15:52 -0400 Subject: [PATCH 1/3] only go 2-deep for clara --- libexec/profile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libexec/profile b/libexec/profile index a16b534935..dc6088a323 100755 --- a/libexec/profile +++ b/libexec/profile @@ -25,7 +25,7 @@ done shift $((OPTIND-1)) executable=$1 arguments=${@:2} -logfile=asprof$stub.log +logfile=asprof_$event$stub.log which asprof >& /dev/null [ "$?" -ne 0 ] && echo 'ERROR: asprof is not in $PATH.' && echo -e $usage2 && exit 3 @@ -42,13 +42,17 @@ set -e $executable $arguments >> $logfile 2>&1 & set +e +# figure out the process id to profile: pid_bash=$! echo info: pid bash=$pid_bash, getting java ... sleep 1 pid_java=$(pgrep -P $pid_bash) -sleep 1 -# go 2 deep for run-clara: -pid_java=$(pgrep -P $pid_java | head -n 1) +if [[ "$executable" == *clara* ]] +then + # go 2 deep for run-clara: + sleep 1 + pid_java=$(pgrep -P $pid_java | head -n 1) +fi echo info: pid java=$pid_java tail -f $logfile & pid_tail=$! From 3bbb4d297f80999789880dfb85e91da00889b1ab Mon Sep 17 00:00:00 2001 From: Nathan Baltzell Date: Thu, 15 Oct 2026 16:17:31 -0400 Subject: [PATCH 2/3] fix thread-affinity option, change output names --- libexec/scaling | 18 +++++++++--------- libexec/scaling.gpl | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libexec/scaling b/libexec/scaling index 6cad8e3450..01e714d2af 100755 --- a/libexec/scaling +++ b/libexec/scaling @@ -7,9 +7,9 @@ def cli(): cli.add_argument('-c','--clara', metavar='DIR',help='CLARA_HOME path (default=$CLARA_HOME)',default=os.getenv('CLARA_HOME',None)) cli.add_argument('-t','--threads',metavar='#',help='threads (default=8,16,24,34,44)',default='8,16,24,34,44') cli.add_argument('-e','--events', metavar='#',help='events per thread (default=555)',default=555,type=int) - cli.add_argument('-N','--numa', metavar='#',help='restrict to a NUMA socket (choices=[0,1])',choices=[0,1]) + cli.add_argument('-N','--numa', metavar='#',help='restrict to a NUMA socket (choices=[0,1])',choices=[0,1], type=int) cli.add_argument('-C','--cpus', metavar='#',help='restrict to a CPU list (e.g. 0,1,2,3)') - cli.add_argument('-T','--cputhr', metavar='#',help='restrict to same number of CPUs as threads') + cli.add_argument('-T','--cputhr', help='restrict to same number of CPUs as threads',action='store_true') cli.add_argument('datafile', help='input EVIO/HIPO data file') cfg = cli.parse_args() cfg.threads = cfg.threads.split(',') @@ -17,8 +17,8 @@ def cli(): cli.error('cannot find CLARA installation via -c or $CLARA_HOME') elif shutil.which('run-clara'): cfg.run_clara = shutil.which('run-clara') - elif os.path.exists(clara_home + '/plugins/clas12/bin/run-clara'): - cfg.run_clara = clara_home + '/plugins/clas12/bin/run-clara' + elif os.path.exists(cfg.clara + '/plugins/clas12/bin/run-clara'): + cfg.run_clara = cfg.clara + '/plugins/clas12/bin/run-clara' else: cli.error('cannot find run-clara in $PATH or $CLARA_HOME') if cfg.cpus: @@ -55,7 +55,7 @@ def benchmark(cfg, threads, log): # use taskset for thread affinity: if cfg.cpus: if cfg.cputhr: - cmd.extend(['taskset','-c',','.join(cfg.cpus.split(',')[:threads])]) + cmd.extend(['taskset','-c',','.join(cfg.cpus.split(',')[:int(threads)])]) else: cmd.extend(['taskset','-c',cfg.cpus]) # add the run-clara command: @@ -122,7 +122,7 @@ def show(benchmarks): print(' '.join([str(x) for x in row])) def save(benchmarks): - with open('scaling.txt','w') as f: + with open('scaling-clara.txt','w') as f: for row in table(benchmarks): f.write(' '.join([str(x) for x in row])+'\n') @@ -130,11 +130,11 @@ def plot(): import os,shutil,subprocess if shutil.which('gnuplot'): g = os.path.dirname(os.path.abspath(__file__))+'/scaling.gpl' - r = subprocess.run(['gnuplot',g], capture_output=True, text=True) + r = subprocess.run(['gnuplot',g,'scaling-clara.txt'], capture_output=True, text=True) if r.returncode == 0: - with open('scaling.svg','w') as f: + with open('scaling-clara.svg','w') as f: f.write(r.stdout) - print('Info: created scaling.svg from scaling.txt and scaling.gpl!') + print('Info: created scaling-clara.svg from scaling-clara.txt and coatjava/libexec/scaling.gpl!') else: print(r.stdout) print(r.stderr) diff --git a/libexec/scaling.gpl b/libexec/scaling.gpl index 3c5598d0d4..41577fd517 100644 --- a/libexec/scaling.gpl +++ b/libexec/scaling.gpl @@ -43,7 +43,7 @@ set style line 37 pt 6 lt 1 lc rgb '#FDBF6F' # light orange set style line 38 pt 6 lt 1 lc rgb '#FF7F00' # dark orange # parse command line arguments: -datafile = 'scaling.txt' +datafile = 'scaling-clara.txt' if (ARGC > 0) { if (ARGV[1] eq "-u") { uberMode = 1 From e15936d3d41504599f380afda778cd65e5c230cd Mon Sep 17 00:00:00 2001 From: Nathan Baltzell Date: Thu, 15 Oct 2026 16:21:24 -0400 Subject: [PATCH 3/3] adapt gitlab-ci --- .gitlab-ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d42ca40d5f..8d5fef4dcb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -179,9 +179,9 @@ profile: extends: .clon allow_failure: true script: - - ./clara/plugins/clas12/libexec/profile -e cpu run-clara -c ./clara -y ./etc/services/rgd-clarode.yml -o tmp1 -t 16 -l $EVIOFILE - - ./clara/plugins/clas12/libexec/profile -e alloc run-clara -c ./clara -y ./etc/services/rgd-clarode.yml -o tmp2 -t 16 -l $EVIOFILE - - ./clara/plugins/clas12/libexec/profile -e lock run-clara -c ./clara -y ./etc/services/rgd-clarode.yml -o tmp3 -t 16 -l $EVIOFILE + - ./clara/plugins/clas12/libexec/profile -e cpu -o _clara -- run-clara -c ./clara -y ./etc/services/rgd-clarode.yml -o tmp1 -t 16 -l $EVIOFILE + - ./clara/plugins/clas12/libexec/profile -e alloc -o _clara -- run-clara -c ./clara -y ./etc/services/rgd-clarode.yml -o tmp2 -t 16 -l $EVIOFILE + - ./clara/plugins/clas12/libexec/profile -e lock -o _clara -- run-clara -c ./clara -y ./etc/services/rgd-clarode.yml -o tmp3 -t 16 -l $EVIOFILE artifacts: when: always expire_in: 1 week @@ -197,7 +197,7 @@ scaling: when: always expire_in: 1 week paths: - - scaling.svg + - scaling*.svg pages: stage: deploy @@ -207,7 +207,7 @@ pages: - cp -r pages public - mkdir public/perf - cp asprof*.html public/perf - - cp scaling.svg public/perf + - cp scaling*.svg public/perf pages: true artifacts: expire_in: 1 week