Changeset 3c56da87 in sasmodels for sasmodels/kerneldll.py
- Timestamp:
- Mar 4, 2015 10:55:38 PM (9 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:
- 3a45c2c
- Parents:
- b89f519
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/kerneldll.py
rf734e7d r3c56da87 19 19 COMPILE = "gcc -shared -fPIC -std=c99 -O2 -Wall %(source)s -o %(output)s -lm" 20 20 elif os.name == 'nt': 21 # make sure vcvarsall.bat is called first in order to set compiler, headers, lib paths, etc.21 # call vcvarsall.bat before compiling to set path, headers, libs, etc. 22 22 if "VCINSTALLDIR" in os.environ: 23 23 # MSVC compiler is available, so use it. … … 25 25 # TODO: maybe don't use randomized name for the c file 26 26 COMPILE = "cl /nologo /Ox /MD /W3 /GS- /DNDEBUG /Tp%(source)s /openmp /link /DLL /INCREMENTAL:NO /MANIFEST /OUT:%(output)s" 27 # Can't find VCOMP90.DLL (don't know why), so remove openmp support from windows compiler build 27 # Can't find VCOMP90.DLL (don't know why), so remove openmp support 28 # from windows compiler build 28 29 #COMPILE = "cl /nologo /Ox /MD /W3 /GS- /DNDEBUG /Tp%(source)s /link /DLL /INCREMENTAL:NO /MANIFEST /OUT:%(output)s" 29 30 else: … … 123 124 self.__dict__ = state 124 125 125 def __call__(self, input):126 def __call__(self, q_input): 126 127 if self.dll is None: self._load_dll() 127 kernel = self.Iqxy if input.is_2D else self.Iq128 return DllKernel(kernel, self.info, input)128 kernel = self.Iqxy if q_input.is_2D else self.Iq 129 return DllKernel(kernel, self.info, q_input) 129 130 131 # pylint: disable=no-self-use 130 132 def make_input(self, q_vectors): 131 133 """ … … 150 152 *info* is the module information 151 153 152 * input* is the DllInput q vectors at which the kernel should be154 *q_input* is the DllInput q vectors at which the kernel should be 153 155 evaluated. 154 156 … … 161 163 Call :meth:`release` when done with the kernel instance. 162 164 """ 163 def __init__(self, kernel, info, input):165 def __init__(self, kernel, info, q_input): 164 166 self.info = info 165 self. input =input167 self.q_input = q_input 166 168 self.kernel = kernel 167 self.res = np.empty( input.nq,input.dtype)168 dim = '2d' if input.is_2D else '1d'169 self.res = np.empty(q_input.nq, q_input.dtype) 170 dim = '2d' if q_input.is_2D else '1d' 169 171 self.fixed_pars = info['partype']['fixed-'+dim] 170 172 self.pd_pars = info['partype']['pd-'+dim] … … 174 176 175 177 def __call__(self, fixed_pars, pd_pars, cutoff): 176 real = np.float32 if self. input.dtype == F32 else np.float64178 real = np.float32 if self.q_input.dtype == F32 else np.float64 177 179 178 nq = c_int(self. input.nq)180 nq = c_int(self.q_input.nq) 179 181 if pd_pars: 180 182 cutoff = real(cutoff) 181 183 loops_N = [np.uint32(len(p[0])) for p in pd_pars] 182 184 loops = np.hstack(pd_pars) 183 loops = np.ascontiguousarray(loops.T, self. input.dtype).flatten()185 loops = np.ascontiguousarray(loops.T, self.q_input.dtype).flatten() 184 186 p_loops = loops.ctypes.data 185 187 dispersed = [p_loops, cutoff] + loops_N … … 187 189 dispersed = [] 188 190 fixed = [real(p) for p in fixed_pars] 189 args = self. input.q_pointers + [self.p_res, nq] + dispersed + fixed191 args = self.q_input.q_pointers + [self.p_res, nq] + dispersed + fixed 190 192 #print pars 191 193 self.kernel(*args)
Note: See TracChangeset
for help on using the changeset viewer.