Changeset cb6ecf4 in sasmodels
- Timestamp:
- Feb 13, 2015 5:20:52 PM (10 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- b3f6bc3
- Parents:
- f5b9a6b
- Files:
-
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
doc/genmodel.py
r19dcb933 rcb6ecf4 12 12 13 13 # Load the doc string from the module definition file and store it in rst 14 from sasmodels import gen 15 docstr = gen .doc(module)14 from sasmodels import generate 15 docstr = generate.doc(module) 16 16 open(sys.argv[2],'w').write(docstr) -
sasmodels/dll.py
r87c722e rcb6ecf4 10 10 import numpy as np 11 11 12 from . import gen 13 14 from .gen import F32, F6412 from . import generate 13 14 from .generate import F32, F64 15 15 # Compiler platform details 16 16 if sys.platform == 'darwin': … … 52 52 import tempfile 53 53 54 source, info = gen .make(kernel_module)55 source_files = gen .sources(info) + [info['filename']]54 source, info = generate.make(kernel_module) 55 source_files = generate.sources(info) + [info['filename']] 56 56 newest = max(os.path.getmtime(f) for f in source_files) 57 57 dllpath = dll_path(info) … … 103 103 self.dll = ct.CDLL(self.dllpath) 104 104 105 self.Iq = self.dll[gen .kernel_name(self.info, False)]105 self.Iq = self.dll[generate.kernel_name(self.info, False)] 106 106 self.Iq.argtypes = IQ_ARGS + [c_double]*Nfixed1d + [c_int]*Npd1d 107 107 108 self.Iqxy = self.dll[gen .kernel_name(self.info, True)]108 self.Iqxy = self.dll[generate.kernel_name(self.info, True)] 109 109 self.Iqxy.argtypes = IQXY_ARGS + [c_double]*Nfixed2d + [c_int]*Npd2d 110 110 -
sasmodels/gpu.py
rf5b9a6b rcb6ecf4 27 27 from pyopencl import mem_flags as mf 28 28 29 from . import gen 29 from . import generate 30 30 31 31 F64_DEFS = """\ … … 50 50 so models can be defined without using too many resources. 51 51 """ 52 source, info = gen .make(kernel_module)52 source, info = generate.make(kernel_module) 53 53 ## for debugging, save source to a .cl file, edit it, and reload as model 54 54 #open(info['name']+'.cl','w').write(source) … … 112 112 """ 113 113 dtype = np.dtype(dtype) 114 if dtype==gen .F64 and not all(has_double(d) for d in context.devices):114 if dtype==generate.F64 and not all(has_double(d) for d in context.devices): 115 115 raise RuntimeError("Double precision not supported for devices") 116 116 117 header = F64_DEFS if dtype == gen .F64 else ""118 if dtype == gen .F32:119 source = gen .use_single(source)117 header = F64_DEFS if dtype == generate.F64 else "" 118 if dtype == generate.F32: 119 source = generate.use_single(source) 120 120 # Note: USE_SINCOS makes the intel cpu slower under opencl 121 121 if context.devices[0].type == cl.device_type.GPU: … … 170 170 is an optional extension which may not be available on all devices. 171 171 """ 172 def __init__(self, source, info, dtype=gen .F32):172 def __init__(self, source, info, dtype=generate.F32): 173 173 self.info = info 174 174 self.source = source … … 189 189 if self.program is None: 190 190 self.program = environment().compile_program(self.info['name'],self.source, self.dtype) 191 kernel_name = gen .kernel_name(self.info, input.is_2D)191 kernel_name = generate.kernel_name(self.info, input.is_2D) 192 192 kernel = getattr(self.program, kernel_name) 193 193 return GpuKernel(kernel, self.info, input) … … 233 233 buffer will be released when the data object is freed. 234 234 """ 235 def __init__(self, q_vectors, dtype=gen .F32):235 def __init__(self, q_vectors, dtype=generate.F32): 236 236 env = environment() 237 237 self.nq = q_vectors[0].size … … 294 294 295 295 def __call__(self, pars, pd_pars, cutoff=1e-5): 296 real = np.float32 if self.input.dtype == gen .F32 else np.float64296 real = np.float32 if self.input.dtype == generate.F32 else np.float64 297 297 fixed = [real(p) for p in pars] 298 298 cutoff = real(cutoff)
Note: See TracChangeset
for help on using the changeset viewer.