Skip to content

Commit

Permalink
[CudaMathEngine] add syncs VectorCopy and VectorConvert
Browse files Browse the repository at this point in the history
Signed-off-by: Kirill Golikov <kirill.golikov@abbyy.com>
  • Loading branch information
favorart committed Feb 29, 2024
1 parent 3c378dc commit e34bbf1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions NeoMathEngine/src/GPU/CUDA/CudaMathEngineVectorMath.cu
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ void CCudaMathEngine::VectorCopy(const CFloatHandle& first, const CConstFloatHan
{
ASSERT_EXPR(first.GetMathEngine() == this);
ASSERT_EXPR(second.GetMathEngine() == this);
SetCudaDevice( device->DeviceNumber );

ASSERT_CUDA( cudaMemcpy(GetRaw(first), GetRaw(second), vectorSize * sizeof(float), cudaMemcpyDeviceToDevice));
}
Expand All @@ -40,6 +41,7 @@ void CCudaMathEngine::VectorCopy(const CIntHandle& first, const CConstIntHandle&
{
ASSERT_EXPR(first.GetMathEngine() == this);
ASSERT_EXPR(second.GetMathEngine() == this);
SetCudaDevice( device->DeviceNumber );

ASSERT_CUDA( cudaMemcpy(GetRaw(first), GetRaw(second), vectorSize * sizeof(int), cudaMemcpyDeviceToDevice));
}
Expand Down Expand Up @@ -131,6 +133,7 @@ void CCudaMathEngine::VectorConvert(const CConstFloatHandle& from, const CIntHan
ASSERT_EXPR(from.GetMathEngine() == this);
ASSERT_EXPR(to.GetMathEngine() == this);
ASSERT_EXPR(vectorSize >= 0);
SetCudaDevice( device->DeviceNumber );

int blockCount;
int threadCount;
Expand All @@ -144,6 +147,7 @@ void CCudaMathEngine::VectorConvert(const CConstIntHandle& from, const CFloatHan
ASSERT_EXPR(from.GetMathEngine() == this);
ASSERT_EXPR(to.GetMathEngine() == this);
ASSERT_EXPR(vectorSize >= 0);
SetCudaDevice( device->DeviceNumber );

int blockCount;
int threadCount;
Expand Down

0 comments on commit e34bbf1

Please sign in to comment.