From fb66888cc93e51ceebc9856c1df18a450cc8178f Mon Sep 17 00:00:00 2001 From: Viktor Gal Date: Mon, 14 May 2018 14:47:11 +0200 Subject: [PATCH] SGVector/Matrix gpu checks should be inlined --- src/shogun/lib/SGMatrix.h | 4 ++-- src/shogun/lib/SGVector.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shogun/lib/SGMatrix.h b/src/shogun/lib/SGMatrix.h index 7042d94d79b..59bb8167b87 100644 --- a/src/shogun/lib/SGMatrix.h +++ b/src/shogun/lib/SGMatrix.h @@ -76,7 +76,7 @@ template class SGMatrix : public SGReferencedData * * @return true if matrix is on GPU */ - bool on_gpu() const + SG_FORCED_INLINE bool on_gpu() const { return gpu_ptr != NULL; } @@ -474,7 +474,7 @@ template class SGMatrix : public SGReferencedData /** Assert whether the data is on GPU * and raise error if the data is on GPU */ - void assert_on_cpu() const + SG_FORCED_INLINE void assert_on_cpu() const { if (on_gpu()) SG_SERROR("Direct memory access not possible when data is in GPU memory.\n"); diff --git a/src/shogun/lib/SGVector.h b/src/shogun/lib/SGVector.h index 9b83971f755..c9c3ba73f28 100644 --- a/src/shogun/lib/SGVector.h +++ b/src/shogun/lib/SGVector.h @@ -83,7 +83,7 @@ template class SGVector : public SGReferencedData * * @return true if vector is on GPU */ - bool on_gpu() const + SG_FORCED_INLINE bool on_gpu() const { return gpu_ptr != NULL; } @@ -573,7 +573,7 @@ template class SGVector : public SGReferencedData /** Assert whether the data is on GPU * and raise error if the data is on GPU */ - void assert_on_cpu() const + SG_FORCED_INLINE void assert_on_cpu() const { if (on_gpu()) SG_SERROR("Direct memory access not possible when data is in GPU memory.\n");