Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

Commit

Permalink
added parallelization affinities
Browse files Browse the repository at this point in the history
  • Loading branch information
schreiberx committed Oct 5, 2018
1 parent bd0dcb0 commit 32727ea
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 9 deletions.
33 changes: 26 additions & 7 deletions platforms/50_cheyenne_gnu_economy/SWEETPlatform.py
@@ -1,6 +1,7 @@
import platform
import socket
import sys
import os

from SWEET import *
from . import SWEETPlatformAutodetect
Expand Down Expand Up @@ -130,19 +131,31 @@ def jobscript_get_header(j : SWEETJobGeneration):
if p.force_turbo_off:
content += "#PBS -l select=cpufreq=2300000\n"

ld_library_path = os.getenv('LD_LIBRARY_PATH')

content += """#
#PBS -N """+_job_id[0:100]+"""
#PBS -o """+j.p_job_stdout_filepath+"""
#PBS -e """+j.p_job_stderr_filepath+"""
source /etc/profile.d/modules.sh
#source /etc/profile.d/modules.sh
#module load openmpi
"""+("module load mkl" if j.compile.mkl==True or j.compile.mkl=='enable' else "")+"""
"""+p_gen_script_info(j)+"""
# Make sure that SWEET library path is really known
export LD_LIBRARY_PATH=\""""+ld_library_path+""":$LD_LIBRARY_PATH\"
echo
echo "LD_LIBRARY_PATH"
echo "${LD_LIBRARY_PATH}"
echo
echo
echo "hostname"
hostname
Expand All @@ -158,19 +171,25 @@ def jobscript_get_header(j : SWEETJobGeneration):
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq | sort -u
echo
"""

if j.compile.threading != 'off':
content += """
export OMP_NUM_THREADS="""+str(p.num_threads_per_rank)+"""
"""

content += """
export OMP_PROC_BIND=close
"""
if p.core_oversubscription:
raise Exception("Not supported with this script!")

if p.core_affinity != None:

content += "\necho \"Affnity: "+str(p.core_affinity)+"\"\n"
if p.core_affinity == 'compact':
content += "\nexport OMP_PROC_BIND=close\n"
elif p.core_affinity == 'scatter':
content += "\nexport OMP_PROC_BIND=spread\n"
else:
raise Exception("Affinity '"+str(p.core_affinity)+"' not supported")

return content

Expand Down
3 changes: 2 additions & 1 deletion platforms/50_cheyenne_intel_economy/SWEETPlatform.py
@@ -1,6 +1,7 @@
import platform
import socket
import sys
import os

from SWEET import *
from . import SWEETPlatformAutodetect
Expand Down Expand Up @@ -130,7 +131,7 @@ def jobscript_get_header(j : SWEETJobGeneration):
if p.force_turbo_off:
content += "#PBS -l select=cpufreq=2300000\n"

ld_library_path = sys.getenv('LD_LIBRARY_PATH')
ld_library_path = os.getenv('LD_LIBRARY_PATH')

content += """#
#PBS -N """+_job_id[0:100]+"""
Expand Down
10 changes: 10 additions & 0 deletions python_mods/SWEETParallelization.py
Expand Up @@ -52,6 +52,16 @@ def __init__(self):
# Force disabling of turbo mode (if supported)
self.force_turbo_off = False

# Qualitative settings

# Allow oversubscription (aka Hyperthreading)
self.core_oversubscription = False

# affinities:
# compact, scatter
self.core_affinity = None



def reset(self):
"""
Expand Down
1 change: 0 additions & 1 deletion scripts/SWEETParameters.py

This file was deleted.

0 comments on commit 32727ea

Please sign in to comment.