Skip to content
Snippets Groups Projects
Commit d92c7ee5 authored by Jean-Matthieu Etancelin's avatar Jean-Matthieu Etancelin
Browse files

Fix OpenCL devices exploring at parmes building for non opencl environments....

Fix OpenCL devices exploring at parmes building for non opencl environments. Add a Froggy environment configuration file.
parent 20275c42
No related branches found
No related tags found
No related merge requests found
## Source this file to get a clean working environment on Froggy
## It uses the binaries and libraries from /home/perignon
source /applis/site/env.bash
module load gcc/4.8.1_gcc-4.4.6
module load cmake/2.8.11.2_gcc-4.4.6
. /home/perignon/MyPython/bin/activate
export PATH=/home/perignon/install-gnu-4.8/bin/:${PATH}
export LD_LIBRARY_PATH=/home/perignon/install-gnu-4.8/lib/:/applis/site/stow/gcc_4.4.6/gcc_4.8.1/lib64:${LD_LIBRARY_PATH}
export PYTHONPATH=~/.local/lib/python2.7/site-packages:/home/perignon/MyPython/lib/python2.7/site-packages:/home/perignon/install-gnu-4.8/lib/python2.7/site-packages
export CC=mpicc CXX=mpic++ FC=mpif90
unset LDFLAGS
unset CFLAGS
## Build parmes helping cmake to find FFTW headers:
# cmake path-to-Parmes -Dfftw_DIR=/home/perignon/install-gnu-4.8/
# make install -j 8
...@@ -9,7 +9,7 @@ import pyopencl as cl ...@@ -9,7 +9,7 @@ import pyopencl as cl
def size_human(s): def size_human(s):
"""Converts size in Bytes into human readable size""" """Converts size in Bytes into human readable size"""
c = ['b', 'Kb', 'Mb', 'Gb'] c = ['b', 'Kb', 'Mb', 'Gb']
i=0 i = 0
while s >= 1024: while s >= 1024:
s /= 1024 s /= 1024
i += 1 i += 1
...@@ -28,43 +28,44 @@ def get_defaults(device_type=cl.device_type.GPU): ...@@ -28,43 +28,44 @@ def get_defaults(device_type=cl.device_type.GPU):
default_device = j default_device = j
default_platform = i default_platform = i
except cl.LogicError: except cl.LogicError:
print (" -- Warning : You are running for a non-OpenCL place " + import sys
"such as a frontend. Using a default id") sys.stderr.write("WARNING : You are running for a non-OpenCL place " +
"such as a frontend. Using a default id: 0 0")
return default_platform, default_device return default_platform, default_device
def explore(device_type=cl.device_type.GPU): def explore(device_type=cl.device_type.GPU):
"""Explore platforms and devices""" """Explore platforms and devices"""
p_data, d_data = {}, {} p_data, d_data = {}, {}
platforms = cl.get_platforms()
platforms_info = ["name ",
"version ",
"vendor "]
all_devices = []
unchanged = lambda x: x
boolean = lambda b: 'Yes' if b else 'No'
type_str = cl.device_type.to_string
devices_info = [("name ", unchanged),
("version ", unchanged),
("vendor ", unchanged),
("profile ", unchanged),
("type ", type_str),
("compiler_available ", boolean),
("double_fp_config ", boolean),
("single_fp_config ", boolean),
("global_mem_size ", size_human),
("local_mem_size ", size_human),
("max_compute_units ", unchanged),
("max_mem_alloc_size ", size_human),
("max_work_group_size ", unchanged),
("max_work_item_dimensions", unchanged),
("max_work_item_sizes ", unchanged),
("extensions ", unchanged),
]
p_str_max = []
d_str_max = {}
out = ""
try: try:
platforms = cl.get_platforms()
platforms_info = ["name ",
"version ",
"vendor "]
all_devices = []
unchanged = lambda x: x
boolean = lambda b: 'Yes' if b else 'No'
type_str = cl.device_type.to_string
devices_info = [("name ", unchanged),
("version ", unchanged),
("vendor ", unchanged),
("profile ", unchanged),
("type ", type_str),
("compiler_available ", boolean),
("double_fp_config ", boolean),
("single_fp_config ", boolean),
("global_mem_size ", size_human),
("local_mem_size ", size_human),
("max_compute_units ", unchanged),
("max_mem_alloc_size ", size_human),
("max_work_group_size ", unchanged),
("max_work_item_dimensions", unchanged),
("max_work_item_sizes ", unchanged),
("extensions ", unchanged),
]
p_str_max = []
d_str_max = {}
out = ""
for i, plt in enumerate(platforms): for i, plt in enumerate(platforms):
p_str_max.append(0) p_str_max.append(0)
devices = plt.get_devices() devices = plt.get_devices()
...@@ -133,4 +134,4 @@ if __name__ == "__main__": ...@@ -133,4 +134,4 @@ if __name__ == "__main__":
p_id, d_id = get_defaults(device_type=cl.device_type.CPU) p_id, d_id = get_defaults(device_type=cl.device_type.CPU)
else: else:
p_id, d_id = get_defaults() p_id, d_id = get_defaults()
print str(p_id) + ' ' + str(d_id) print (str(p_id) + ' ' + str(d_id))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment