Skip to content

Commit 21e738c

Browse files
committed
use class mangled names for gpu methods
1 parent f258b62 commit 21e738c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/aspire/abinitio/commonline_sync3n.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def __init__(
108108
)
109109

110110
# Auto configure GPU
111-
self._gpu_module = None
111+
self.__gpu_module = None
112112
try:
113113
import cupy as cp
114114

@@ -117,7 +117,7 @@ def __init__(
117117
logger.info(
118118
f"cupy and GPU {gpu_id} found by cuda runtime; enabling cupy."
119119
)
120-
self._gpu_module = self._init_cupy_module()
120+
self.__gpu_module = self.__init_cupy_module()
121121
else:
122122
logger.info("GPU not found, defaulting to numpy.")
123123

@@ -360,7 +360,7 @@ def _triangle_scores_inner(self, Rijs):
360360
"""
361361

362362
# host/gpu dispatch
363-
if self._gpu_module:
363+
if self.__gpu_module:
364364
scores_hist = self._triangle_scores_inner_cupy(Rijs)
365365
else:
366366
scores_hist = self._triangle_scores_inner_host(Rijs)
@@ -460,7 +460,7 @@ def _triangle_scores_inner_cupy(self, Rijs):
460460

461461
import cupy as cp
462462

463-
triangle_scores = self._gpu_module.get_function("triangle_scores_inner")
463+
triangle_scores = self.__gpu_module.get_function("triangle_scores_inner")
464464

465465
Rijs_dev = cp.array(Rijs, dtype=np.float64)
466466

@@ -511,7 +511,7 @@ def _pairs_probabilities(self, Rijs, P2, A, a, B, b, x0):
511511
params = np.array([P2, A, a, B, b, x0], dtype=np.float64)
512512

513513
# host/gpu dispatch
514-
if self._gpu_module:
514+
if self.__gpu_module:
515515
ln_f_ind, ln_f_arb = self._pairs_probabilities_cupy(Rijs, *params)
516516
else:
517517
ln_f_ind, ln_f_arb = self._pairs_probabilities_host(Rijs, *params)
@@ -625,7 +625,7 @@ def _pairs_probabilities_cupy(self, Rijs, P2, A, a, B, b, x0):
625625

626626
import cupy as cp
627627

628-
pairs_probabilities = self._gpu_module.get_function("pairs_probabilities")
628+
pairs_probabilities = self.__gpu_module.get_function("pairs_probabilities")
629629

630630
Rijs_dev = cp.array(Rijs, dtype=np.float64)
631631
ln_f_ind_dev = cp.zeros((self.n_img * (self.n_img - 1) // 2), dtype=np.float64)
@@ -886,7 +886,7 @@ def _signs_times_v(self, Rijs, vec):
886886
:return: New candidate eigenvector.
887887
"""
888888
# host/gpu dispatch
889-
if self._gpu_module:
889+
if self.__gpu_module:
890890
new_vec = self._signs_times_v_cupy(Rijs, vec)
891891
else:
892892
new_vec = self._signs_times_v_host(Rijs, vec)
@@ -979,7 +979,7 @@ def _signs_times_v_cupy(self, Rijs, vec):
979979
"""
980980
import cupy as cp
981981

982-
signs_times_v = self._gpu_module.get_function("signs_times_v")
982+
signs_times_v = self.__gpu_module.get_function("signs_times_v")
983983

984984
Rijs_dev = cp.array(Rijs, dtype=np.float64)
985985
vec_dev = cp.array(vec, dtype=np.float64)
@@ -1000,7 +1000,7 @@ def _signs_times_v_cupy(self, Rijs, vec):
10001000
return new_vec
10011001

10021002
@staticmethod
1003-
def _init_cupy_module():
1003+
def __init_cupy_module():
10041004
"""
10051005
Private utility method to read in CUDA source and return as
10061006
compiled CUPY module.

0 commit comments

Comments
 (0)