LSSTApplications  16.0-10-g0ee56ad+4,16.0-11-ga33d1f2+4,16.0-12-g3ef5c14+2,16.0-12-g71e5ef5+17,16.0-12-gbdf3636+2,16.0-13-g118c103+2,16.0-13-g8f68b0a+2,16.0-15-gbf5c1cb+3,16.0-16-gfd17674+2,16.0-17-g7c01f5c+2,16.0-18-g0a50484,16.0-20-ga20f992+7,16.0-21-g0e05fd4+5,16.0-21-g15e2d33+3,16.0-22-g62d8060+3,16.0-22-g847a80f+3,16.0-25-gf00d9b8,16.0-28-g3990c221+3,16.0-3-gf928089+2,16.0-32-g88a4f23+4,16.0-34-gd7987ad+2,16.0-37-gc7333cb+1,16.0-4-g10fc685+1,16.0-4-g18f3627+25,16.0-4-g5f3a788+25,16.0-5-gaf5c3d7+3,16.0-5-gcc1f4bb,16.0-6-g3b92700+3,16.0-6-g4412fcd+2,16.0-6-g7235603+3,16.0-69-g2562ce1b+1,16.0-7-g0913a87,16.0-8-g14ebd58+3,16.0-8-g2df868b,16.0-8-g4cec79c+5,16.0-8-gadf6c7a,16.0-82-g59ec2a54a,16.0-9-g5400cdc+1,16.0-9-ge6233d7+4,master-g2880f2d8cf+2,v17.0.rc1
LSSTDataManagementBasePackage
cuda.py
Go to the documentation of this file.
1 """
2 cuda
3 
4 CUDA Tool for SCons
5 
6 """
7 
8 import os
9 import SCons.Tool
10 import SCons.Scanner.C
11 import SCons.Defaults
12 
13 CUDAScanner = SCons.Scanner.C.CScanner()
14 
15 
16 # this object emitters add '.linkinfo' suffixed files as extra targets
17 # these files are generated by nvcc. The reason to do this is to remove
18 # the extra .linkinfo files when calling scons -c
19 def CUDANVCCStaticObjectEmitter(target, source, env):
20  tgt, src = SCons.Defaults.StaticObjectEmitter(target, source, env)
21  for file in src:
22  lifile = os.path.splitext(src[0].rstr())[0] + '.linkinfo' # noqa F841
23  # tgt.append(lifile)
24  return tgt, src
25 
26 
27 def CUDANVCCSharedObjectEmitter(target, source, env):
28  tgt, src = SCons.Defaults.SharedObjectEmitter(target, source, env)
29  for file in src:
30  lifile = os.path.splitext(src[0].rstr())[0] + '.linkinfo' # noqa F841
31  # tgt.append(lifile)
32  return tgt, src
33 
34 
35 def generate(env):
36  staticObjBuilder, sharedObjBuilder = SCons.Tool.createObjBuilders(env)
37  staticObjBuilder.add_action('.cu', '$STATICNVCCCMD')
38  staticObjBuilder.add_emitter('.cu', CUDANVCCStaticObjectEmitter)
39  sharedObjBuilder.add_action('.cu', '$SHAREDNVCCCMD')
40  sharedObjBuilder.add_emitter('.cu', CUDANVCCSharedObjectEmitter)
41  SCons.Tool.SourceFileScanner.add_scanner('.cu', CUDAScanner)
42 
43  # default compiler
44  env['NVCC'] = 'nvcc'
45 
46  # default flags for the NVCC compiler
47  env['NVCCFLAGS'] = ''
48  env['STATICNVCCFLAGS'] = ''
49  env['SHAREDNVCCFLAGS'] = ''
50  env['ENABLESHAREDNVCCFLAG'] = '-shared'
51  env['NVCCCMDLINE'] = ''
52 
53  # default NVCC commands
54  env['STATICNVCCCMD'] = \
55  '$NVCC -o $TARGET -c $NVCCFLAGS $_CPPINCFLAGS $STATICNVCCFLAGS $NVCCCMDLINE $SOURCES'
56  env['SHAREDNVCCCMD'] = '$NVCC -o $TARGET -c $NVCCFLAGS $_CPPINCFLAGS $SHAREDNVCCFLAGS' \
57  ' $ENABLESHAREDNVCCFLAG $NVCCCMDLINE $SOURCES'
58 
59 
60 def exists(env):
61  return env.Detect('nvcc')
def CUDANVCCSharedObjectEmitter(target, source, env)
Definition: cuda.py:27
def generate(env)
Definition: cuda.py:35
def exists(env)
Definition: cuda.py:60
def CUDANVCCStaticObjectEmitter(target, source, env)
Definition: cuda.py:19