Fix hipStreamAddCallback testcase for nvcc

Change-Id: Ieec4b8d7933d8d68394d21d27132da206111efc8


[ROCm/clr commit: 6a37c60eaa]
Este commit está contenido en:
Maneesh Gupta
2018-01-30 12:32:46 +05:30
padre 290b5f1738
commit b2bb274b7e
@@ -24,6 +24,7 @@ THE SOFTWARE.
*/
#include <stdio.h>
#include <unistd.h>
#include "hip/hip_runtime.h"
#include "test_common.h"
@@ -42,16 +43,17 @@ __global__ void vector_square(float *C_d, float *A_d, size_t N)
}
float *A_h, *C_h;
size_t N = 1000000;
bool cbDone = false;
static void HIPRT_CB Callback(hipStream_t stream, hipError_t status, void *userData)
{
for (size_t i=0; i<N; i++) {
if (C_h[i] != A_h[i] * A_h[i]) {
HIPCHECK(hipErrorUnknown);
warn("Data mismatch %zu", i);
}
}
printf ("PASSED!\n");
cbDone = true;
}
int main(int argc, char *argv[])
@@ -84,4 +86,6 @@ int main(int argc, char *argv[])
HIPCHECK(hipMemcpyAsync(C_h, C_d, Nbytes, hipMemcpyDeviceToHost, mystream));
HIPCHECK(hipStreamAddCallback(mystream, Callback, NULL, 0));
while(!cbDone) sleep(1);
}