You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

1. Table of Contents

2. Profilers

I use two profilers:

cProfile - https://docs.python.org/3/library/profile.html

line-profiler - https://pypi.org/project/line-profiler/

3. requirements

python   3.10   module load itm-python/3.10 

line-profiler   tapip install line-profiler 

4. How to run?

  1.  prepare a standard launch 
  2. Copy python  folder from /gss_efgw_work/work/g2fjc/jintrac/v220922/python  to some location on pfs for example: /pfs/work/g2pbloch/python 
  3. Change JINTRAC_PYTHON_DIR  in rjettov (430 line) to python folder on pfs from step 2
  4. Change run_python_driver (line 49) in /pfs/work/g2pbloch/python :
  5. cProfile :  mpirun --allow-run-as-root -np $NPROC python -u  -m cProfile -o jintrac.prof /pfs/work/g2pbloch/jetto_profiler/jintrac_imas_driver.py  mpi 
  6. line-profiler : mpirun --allow-run-as-root -np $NPROC python -u  -m kernprof -l /pfs/work/g2pbloch/jetto_profiler/jintrac_imas_driver.py  mpi 
  7. Run ./rjettov -S -I -p -x64 test v220922 g2fjc 

5. cProfile analysis

To read data from test.prof we need python script. We can use e.g.

cprofile_script.py
import pstats
stats = pstats.Stats('test.prof')
stats.strip_dirs().sort_stats(pstats.SortKey.TIME).print_stats()

This script print data sorted by tottime  column.

We can also make an image from data:

  1.  Install gprof2dot : pip install gprof2dot 
  2. run : python -m gprof2dot -f pstats test.prof | dot -Tsvg -o output.svg
  3.    



  • No labels