-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Baseline MLPF model for CMS, PF group status 24.09.21 [TF] (#81)
* move gen jobs * add additional samples * up * add timing * update timing, add eta eff-fake * baseline training * tagged version of heptfds * uncomment in gen scripts
- Loading branch information
Showing
12 changed files
with
524 additions
and
535 deletions.
There are no files selected for viewing
Submodule hep_tfds
updated
5 files
+1 −1 | heptfds/__init__.py | |
+2 −0 | heptfds/cms_pf/__init__.py | |
+61 −0 | heptfds/cms_pf/singlegamma.py | |
+2 −2 | heptfds/cms_pf/singlemu.py | |
+61 −0 | heptfds/cms_pf/singlepi0.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
file:/scratch-persistent/joosep/store/relval/CMSSW_11_2_0_pre8/RelValMinBias_14TeV/GEN-SIM/112X_mcRun3_2021_realistic_v10-v1/00000/932b9bde-6ae4-44cb-b1db-66dab83ab7d1.root | ||
file:/scratch-persistent/joosep/store/relval/CMSSW_11_2_0_pre8/RelValMinBias_14TeV/GEN-SIM/112X_mcRun3_2021_realistic_v10-v1/00000/33b2fbd9-2544-44af-8652-c9a19edfa400.root | ||
file:/scratch-persistent/joosep/store/relval/CMSSW_11_2_0_pre8/RelValMinBias_14TeV/GEN-SIM/112X_mcRun3_2021_realistic_v10-v1/00000/936b7b11-5eec-4f97-83ff-48be106b100d.root | ||
file:/scratch-persistent/joosep/store/relval/CMSSW_11_2_0_pre8/RelValMinBias_14TeV/GEN-SIM/112X_mcRun3_2021_realistic_v10-v1/00000/f052be2f-f604-48e6-b484-1e412f0391f6.root | ||
file:/scratch-persistent/joosep/store/relval/CMSSW_11_2_0_pre8/RelValMinBias_14TeV/GEN-SIM/112X_mcRun3_2021_realistic_v10-v1/00000/5ac1ea44-a5e0-4454-8945-45fd29c2947f.root | ||
file:/scratch-persistent/joosep/store/relval/CMSSW_11_2_0_pre8/RelValMinBias_14TeV/GEN-SIM/112X_mcRun3_2021_realistic_v10-v1/00000/ae4379b2-d002-4adc-a168-e782ee296f91.root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
#SBATCH -p main | ||
#SBATCH --mem-per-cpu=4G | ||
#SBATCH --cpus-per-task=1 | ||
|
||
env | ||
df -h | ||
|
||
WORKDIR=/scratch/$USER/${SLURM_JOB_ID} | ||
SAMPLE=$1 | ||
SEED=$2 | ||
|
||
mkdir -p $WORKDIR | ||
cd $WORKDIR | ||
|
||
/home/joosep/particleflow/mlpf/data/genjob.sh $SAMPLE $SEED | ||
|
||
cp $WORKDIR/$SAMPLE/$SEED/pfntuple_*.root /hdfs/local/joosep/mlpf/gen/$SAMPLE/root/ | ||
cp $WORKDIR/$SAMPLE/$SEED/pfntuple_*.pkl /hdfs/local/joosep/mlpf/gen/$SAMPLE/raw/ | ||
|
||
rm -Rf $WORKDIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
#SBATCH -p main | ||
#SBATCH --mem-per-cpu=4G | ||
#SBATCH --cpus-per-task=1 | ||
|
||
env | ||
df -h | ||
|
||
WORKDIR=/scratch/$USER/${SLURM_JOB_ID} | ||
SAMPLE=$1 | ||
SEED=$2 | ||
|
||
mkdir -p $WORKDIR | ||
cd $WORKDIR | ||
|
||
/home/joosep/particleflow/mlpf/data/genjob_pu.sh $SAMPLE $SEED | ||
|
||
cp $WORKDIR/$SAMPLE/$SEED/pfntuple_*.root /hdfs/local/joosep/mlpf/gen/$SAMPLE/root/ | ||
cp $WORKDIR/$SAMPLE/$SEED/pfntuple_*.pkl /hdfs/local/joosep/mlpf/gen/$SAMPLE/raw/ | ||
|
||
rm -Rf $WORKDIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,47 @@ | ||
import numpy as np | ||
import time | ||
import subprocess | ||
import shlex | ||
import pynvml | ||
|
||
#pip install only onnxruntime_gpu, not onnxruntime! | ||
import onnxruntime | ||
|
||
if __name__ == "__main__": | ||
EP_list = ['CUDAExecutionProvider'] | ||
pynvml.nvmlInit() | ||
handle = pynvml.nvmlDeviceGetHandleByIndex(0) | ||
|
||
nvidia_smi_call = "nvidia-smi --query-gpu=timestamp,name,pci.bus_id,pstate,power.draw,temperature.gpu,utilization.gpu,utilization.memory,memory.total,memory.free,memory.used --format=csv -l 1 -f nvidia_smi_log.csv" | ||
p = subprocess.Popen(shlex.split(nvidia_smi_call)) | ||
EP_list = ['CUDAExecutionProvider'] | ||
|
||
time.sleep(5) | ||
|
||
mem = pynvml.nvmlDeviceGetMemoryInfo(handle) | ||
mem_initial = mem.used/1000/1000 | ||
print("mem_initial", mem_initial) | ||
|
||
onnx_sess = onnxruntime.InferenceSession("model.onnx", providers=EP_list) | ||
time.sleep(5) | ||
|
||
mem = pynvml.nvmlDeviceGetMemoryInfo(handle) | ||
mem_onnx = mem.used/1000/1000 | ||
print("mem_onnx", mem_initial) | ||
|
||
for num_elems in [3200, 6400, 12800, 25600, 12800, 6400, 3200]: | ||
for num_elems in range(1600, 25600, 320): | ||
times = [] | ||
for i in range(250): | ||
mem_used = [] | ||
|
||
#average over 100 events | ||
for i in range(100): | ||
|
||
#allocate array in system RAM | ||
X = np.array(np.random.randn(1, num_elems, 15), np.float32) | ||
X = np.array(np.random.randn(1, num_elems, 18), np.float32) | ||
|
||
#transfer data to GPU, run model, transfer data back | ||
t0 = time.time() | ||
pred_onx = onnx_sess.run(None, {"x:0": X}) | ||
t1 = time.time() | ||
dt = t1 - t0 | ||
times.append(dt) | ||
mem = pynvml.nvmlDeviceGetMemoryInfo(handle) | ||
mem_used.append(mem.used/1000/1000) | ||
|
||
print("Nelem={} mean_time={:.2f}ms stddev_time={:.2f} ms".format(num_elems, 1000.0*np.mean(times), 1000.0*np.std(times))) | ||
print("Nelem={} mean_time={:.2f} ms stddev_time={:.2f} ms mem_used={:.0f} MB".format(num_elems, 1000.0*np.mean(times), 1000.0*np.std(times), np.max(mem_used))) | ||
time.sleep(5) | ||
|
||
p.terminate() |
Oops, something went wrong.