|
|
|
@ -38,17 +38,13 @@
@@ -38,17 +38,13 @@
|
|
|
|
|
|
|
|
|
|
#include <stdio.h> |
|
|
|
|
|
|
|
|
|
#ifdef __HIPCC__ |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#include "chError.h" |
|
|
|
|
#include "chTimer.h" |
|
|
|
|
|
|
|
|
|
int |
|
|
|
|
main( int argc, char *argv[] ) |
|
|
|
|
{ |
|
|
|
|
hipError_t status; |
|
|
|
|
cudaError_t status; |
|
|
|
|
int *deviceInt = 0; |
|
|
|
|
int *hostInt = 0; |
|
|
|
|
const int cIterations = 100000; |
|
|
|
@ -62,7 +58,7 @@ main( int argc, char *argv[] )
@@ -62,7 +58,7 @@ main( int argc, char *argv[] )
|
|
|
|
|
chTimerTimestamp start, stop; |
|
|
|
|
|
|
|
|
|
cuda(Malloc( &deviceInt, numBytes ) ); |
|
|
|
|
cuda(HostMalloc( (void **) &hostInt, numBytes, 0 ) ); |
|
|
|
|
cuda(HostAlloc( (void **) &hostInt, numBytes, 0 ) ); |
|
|
|
|
|
|
|
|
|
for ( size_t byteCount = byteIncrement; |
|
|
|
|
byteCount <= numBytes; |
|
|
|
@ -72,7 +68,7 @@ main( int argc, char *argv[] )
@@ -72,7 +68,7 @@ main( int argc, char *argv[] )
|
|
|
|
|
chTimerGetTime( &start ); |
|
|
|
|
for ( int i = 0; i < cIterations; i++ ) { |
|
|
|
|
cuda(MemcpyAsync( deviceInt, hostInt, byteCount, |
|
|
|
|
hipMemcpyHostToDevice, NULL ) ); |
|
|
|
|
cudaMemcpyHostToDevice, NULL ) ); |
|
|
|
|
} |
|
|
|
|
cuda(DeviceSynchronize() ); |
|
|
|
|
chTimerGetTime( &stop ); |
|
|
|
@ -85,8 +81,8 @@ main( int argc, char *argv[] )
@@ -85,8 +81,8 @@ main( int argc, char *argv[] )
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hipFree( deviceInt ); |
|
|
|
|
hipHostFree( hostInt ); |
|
|
|
|
cudaFree( deviceInt ); |
|
|
|
|
cudaFreeHost( hostInt ); |
|
|
|
|
return 0; |
|
|
|
|
Error: |
|
|
|
|
printf( "Error performing allocation\n" ); |
|
|
|
|