diff --git a/pyfstat/core.py b/pyfstat/core.py index 6a624985e5c9e256ed76c098c9b984d6969e62a9..feafa008e6d187de93a693d01e57e0c6e8553ddf 100755 --- a/pyfstat/core.py +++ b/pyfstat/core.py @@ -660,7 +660,7 @@ class ComputeFstat(BaseSearchClass): if self.dtau: self.windowRange.dtau = self.dtau - self.tCWFstatMapFeatures, self.gpu_context = tcw.init_transient_fstat_map_features(self.cudaDeviceName) + self.tCWFstatMapFeatures, self.gpu_context = tcw.init_transient_fstat_map_features ( self.tCWFstatMapVersion=='pycuda', self.cudaDeviceName ) def get_fullycoherent_twoF(self, tstart, tend, F0, F1, F2, Alpha, Delta, asini=None, period=None, ecc=None, tp=None, diff --git a/pyfstat/tcw_fstat_map_funcs.py b/pyfstat/tcw_fstat_map_funcs.py index c318c9100e5bf8bea905226909c460d3c54edcb1..c95509a1b97e376f310e1f77dbbaaafb7f139974 100644 --- a/pyfstat/tcw_fstat_map_funcs.py +++ b/pyfstat/tcw_fstat_map_funcs.py @@ -89,7 +89,7 @@ fstatmap_versions = { } -def init_transient_fstat_map_features ( cudaDeviceName ): +def init_transient_fstat_map_features ( wantCuda=False, cudaDeviceName=None ): ''' Initialization of available modules (or "features") for F-stat maps. @@ -115,7 +115,7 @@ def init_transient_fstat_map_features ( cudaDeviceName ): logging.debug('Got the following features for transient F-stat maps:') logging.debug(features) - if features['pycuda']: + if wantCuda and features['pycuda']: logging.debug('CUDA version: {}'.format(drv.get_version())) drv.init() @@ -138,6 +138,7 @@ def init_transient_fstat_map_features ( cudaDeviceName ): else: devnum0 = 0 + matchbit = '' if cudaDeviceName: # allow partial matches in device names devmatches = [devidx for devidx, devname in enumerate(devnames) if cudaDeviceName in devname] @@ -149,12 +150,13 @@ def init_transient_fstat_map_features ( cudaDeviceName ): if len(devmatches) > 1: logging.warning('Found {} CUDA devices matching name "{}". Choosing first one with index {}.'.format(len(devmatches),cudaDeviceName,devnum)) os.environ['CUDA_DEVICE'] = str(devnum) + matchbit = '(matched to user request "{}")'.format(cudaDeviceName) elif 'CUDA_DEVICE' in os.environ: devnum = int(os.environ['CUDA_DEVICE']) else: devnum = 0 devn = devices[devnum] - logging.info('Choosing CUDA device {}, of {} devices present: {} (matched to user request "{}")...'.format(devnum,num_gpus,devn.name(),cudaDeviceName)) + logging.info('Choosing CUDA device {}, of {} devices present: {}{}...'.format(devnum,num_gpus,devn.name(),matchbit)) if devnum == devnum0: gpu_context = context0 else: