Making v2 tests CI ready
Change-Id: Ia32c9b2a1b5f833d1c7b078b678895b736d1e2a1
[ROCm/rocprofiler commit: 13c12bc7e7]
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <hip/hip_runtime.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#define SUCCESS 0
|
||||
#define FAILURE 1
|
||||
|
||||
__global__ void helloworld(char* in, char* out) {
|
||||
int num = hipThreadIdx_x + hipBlockDim_x * hipBlockIdx_x;
|
||||
out[num] = in[num] + 1;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
hipDeviceProp_t devProp;
|
||||
hipGetDeviceProperties(&devProp, 0);
|
||||
|
||||
/* Initial input,output for the host and create memory objects for the
|
||||
* kernel*/
|
||||
const char* input = "GdkknVnqkc";
|
||||
size_t strlength = strlen(input);
|
||||
|
||||
char* output = reinterpret_cast<char*>(malloc(strlength + 1));
|
||||
|
||||
char* inputBuffer;
|
||||
char* outputBuffer;
|
||||
hipMalloc(reinterpret_cast<void**>(&inputBuffer), (strlength + 1) * sizeof(char));
|
||||
hipMalloc(reinterpret_cast<void**>(&outputBuffer), (strlength + 1) * sizeof(char));
|
||||
|
||||
hipMemcpy(inputBuffer, input, (strlength + 1) * sizeof(char), hipMemcpyHostToDevice);
|
||||
|
||||
hipLaunchKernelGGL(helloworld, dim3(1), dim3(strlength), 0, 0, inputBuffer, outputBuffer);
|
||||
|
||||
hipMemcpy(output, outputBuffer, (strlength + 1) * sizeof(char), hipMemcpyDeviceToHost);
|
||||
|
||||
hipFree(inputBuffer);
|
||||
hipFree(outputBuffer);
|
||||
|
||||
output[strlength] = '\0'; // Add the terminal character to the end of output.
|
||||
|
||||
free(output);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user