1. added double dash option to test to avoid warning message about compilation database

2. fixed cmake resource folder discovery for standalone build case
This commit is contained in:
dfukalov committed 2016-03-05 13:59:38 +03:00
1 szülő 8b1643ffb5
commit 41267688d0
3 files changed
+14 -13

No files matched your search

+10 -13
Fájl megtekintése
@@ -1,11 +1,10 @@
// RUN: hipify "%s" 2>&1 | FileCheck %s
#include <helper_cuda.h> // for checkCudaErrors
// RUN: hipify "%s" -o=%t --
// RUN: FileCheck %s -input-file=%t --match-full-lines
#include <iostream>
__global__ void axpy(float a, float* x, float* y) {
// CHECK: hipThreadIdx_x
// CHECK: y[hipThreadIdx_x] = a * x[hipThreadIdx_x];
y[threadIdx.x] = a * x[threadIdx.x];
}
@@ -19,25 +18,23 @@ int main(int argc, char* argv[]) {
// Copy input data to device.
float* device_x;
float* device_y;
checkCudaErrors(cudaMalloc(&device_x, kDataLen * sizeof(float)));
checkCudaErrors(cudaMalloc(&device_y, kDataLen * sizeof(float)));
checkCudaErrors(cudaMemcpy(device_x, host_x, kDataLen * sizeof(float),
cudaMemcpyHostToDevice));
cudaMalloc(&device_x, kDataLen * sizeof(float));
cudaMalloc(&device_y, kDataLen * sizeof(float));
cudaMemcpy(device_x, host_x, kDataLen * sizeof(float), cudaMemcpyHostToDevice);
// Launch the kernel.
// CHECK: hipLaunchKernel(HIP_KERNEL_NAME
// CHECK: hipLaunchKernel(HIP_KERNEL_NAME(axpy), dim3(1), dim3(kDataLen), 0, 0, a, device_x, device_y);
axpy<<<1, kDataLen>>>(a, device_x, device_y);
// Copy output data to host.
checkCudaErrors(cudaDeviceSynchronize());
checkCudaErrors(cudaMemcpy(host_y, device_y, kDataLen * sizeof(float),
cudaMemcpyDeviceToHost));
cudaDeviceSynchronize();
cudaMemcpy(host_y, device_y, kDataLen * sizeof(float), cudaMemcpyDeviceToHost);
// Print the results.
for (int i = 0; i < kDataLen; ++i) {
std::cout << "y[" << i << "] = " << host_y[i] << "\n";
}
checkCudaErrors(cudaDeviceReset());
cudaDeviceReset();
return 0;
}