Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PTV
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Véronique LEGRAND
PTV
Commits
146181ff
Commit
146181ff
authored
4 years ago
by
Veronique Legrand
Browse files
Options
Downloads
Patches
Plain Diff
removed unuseful file for this branch
parent
1a00693e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
_modules/common_OCL_Kernels.py.old
+0
-80
0 additions, 80 deletions
_modules/common_OCL_Kernels.py.old
with
0 additions
and
80 deletions
_modules/common_OCL_Kernels.py.old
deleted
100644 → 0
+
0
−
80
View file @
1a00693e
import pyopencl as cl
import os
## Need that for being able to test on my imac on GPU and macbookpro CPU
class parmsForTesting:
def __init__(self):
self.mac_max_dim1 =-1
self.testing_on_cpu=False
if os.getenv("OSX_TESTING_ON_GPU") != None or os.getenv("OSX_TESTING_ON_CPU") != None:
self.mac_max_dim1 = 256
if os.getenv("OSX_TESTING_ON_CPU") != None:
self.testing_on_cpu=True
## Gets the number of threads that we can run on the chosen device.
# @param input: the number of elements to process (reads or sequences in our case)
# @param input: (device characteristics): maximum number of threads that we can out un dim 1.
def getNbThreads(nb_elem_to_process,device_max_thread_dim1):
remainder = nb_elem_to_process % device_max_thread_dim1
if (remainder != 0):
nb_threads_dim1 = nb_elem_to_process - remainder + device_max_thread_dim1
else:
nb_threads_dim1 = nb_elem_to_process
return nb_threads_dim1
## gets platform and device.
#
# instanciates context and command queue and also get memory flags.
def getOpenCLElements():
parms=parmsForTesting()
l_platforms = cl.get_platforms()
idx_platform = 0
idx_device = -1
gpu_found=False
type_flags = cl.device_type
for p in l_platforms:
l_devices = p.get_devices(device_type=type_flags.GPU)
if len(l_devices) > 0:
gpu_found=True
idx_device = 0 # for the moment, choose the 1rst GPU device we find
break
idx_platform += 1
platform = cl.get_platforms()[idx_platform]
if (gpu_found and not parms.testing_on_cpu):
device = platform.get_devices(device_type=type_flags.GPU)[idx_device]
#device = platform.get_devices()[0]
else:
print "Warning : No GPU found or CPU testing mode, trying to run openCL on CPU"
device = platform.get_devices(device_type=type_flags.CPU)[0]
print "will run on: "
print " Device name:", device.name
print " Device type:", cl.device_type.to_string(device.type)
print " Device memory: ", device.global_mem_size // 1024 // 1024, 'MB'
print " Device max clock speed:", device.max_clock_frequency, 'MHz'
print " Device compute units:", device.max_compute_units
print " Device max work items:", device.get_info(cl.device_info.MAX_WORK_ITEM_SIZES)
print " Device local memory:", device.get_info(cl.device_info.LOCAL_MEM_SIZE) // 1024, 'KB'
print type(device.get_info(cl.device_info.MAX_WORK_ITEM_SIZES))
#m=device.get_info(cl.device_info.MAX_WORK_ITEM_SIZES)[0]
if parms.mac_max_dim1!=-1: # need that as workaround for the buggy openCL implementation on osx. Need to run my tests.
max_dim1=parms.mac_max_dim1
else:
max_dim1=device.get_info(cl.device_info.MAX_WORK_ITEM_SIZES)[0]
ctx = cl.Context([device])
queue = cl.CommandQueue(ctx)
mf = cl.mem_flags
return ctx,queue,mf,max_dim1
## Utility method to process the result of upd_reads_nb_occ_in_sequences_str kernel
def getMaxNbOccPerSeq(o_nb_occ_foreach_extract_in_seqs,nb_reads,nb_seq):
m=0
for idx_s in range(0,nb_seq):
line_start=idx_s*2*nb_reads
tmp=o_nb_occ_foreach_extract_in_seqs[line_start+2*nb_reads-1]+o_nb_occ_foreach_extract_in_seqs[line_start+2*nb_reads-2]
if tmp>m: m=tmp
return m
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment