Skip to content

Commit

Permalink
Fix up numba free
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhanchen authored Jul 30, 2019
1 parent bd8b74c commit 66bf1ea
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions python/cuml/manifold/t_sne.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ class TSNE(Base):
# TSNE is sensitive to what is currently in memory.
# Use Numba's garbabge collector to clean up already removed
# GPU memory.
cuda.current_context().deallocations.clear()
context = cuda.current_context().deallocations
if context is not None:
context.clear()

if n_components < 0:
raise ValueError("n_components = {} should be more "
Expand Down Expand Up @@ -396,7 +398,9 @@ class TSNE(Base):
# TSNE is sensitive to what is currently in memory.
# Use Numba's garbabge collector to clean up already removed
# GPU memory.
cuda.current_context().deallocations.clear()
context = cuda.current_context().deallocations
if context is not None:
context.clear()
self.Y = Y
return self

Expand All @@ -407,7 +411,9 @@ class TSNE(Base):
# TSNE is sensitive to what is currently in memory.
# Use Numba's garbabge collector to clean up already removed
# GPU memory.
cuda.current_context().deallocations.clear()
context = cuda.current_context().deallocations
if context is not None:
context.clear()

def fit_transform(self, X):
"""Fit X into an embedded space and return that transformed output.
Expand Down Expand Up @@ -435,7 +441,9 @@ class TSNE(Base):
# TSNE is sensitive to what is currently in memory.
# Use Numba's garbabge collector to clean up already removed
# GPU memory.
cuda.current_context().deallocations.clear()
context = cuda.current_context().deallocations
if context is not None:
context.clear()
return data
return None # is this even possible?

Expand Down

0 comments on commit 66bf1ea

Please sign in to comment.