changed __global__ attribute
1. Moved around tests and added them to HIT Change-Id: I5d75280c42a5af852670ebabc7305ee56721ec7b
Этот коммит содержится в:
1 родитель
2790e9a448
Коммит
5e3d63c0a3
52 files changed
+316
-411
No files matched your search
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
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 WARRANNTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INNCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANNY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "hip/hip_runtime.h"
|
||||
#include "hip/hip_runtime_api.h"
|
||||
#include<iostream>
|
||||
#include<fstream>
|
||||
#include<vector>
|
||||
|
||||
int main(){
|
||||
hipInit(0);
|
||||
hipDevice_t device;
|
||||
hipDeviceGet(&device, 0);
|
||||
char pciBusId[10];
|
||||
memset(pciBusId,0,10);
|
||||
hipDeviceGetPCIBusId(pciBusId,100,device);
|
||||
printf("PCI Bus ID= %s\n",pciBusId);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
#include<iostream>
|
||||
#include "hip/hip_runtime.h"
|
||||
#include "hip/hip_runtime_api.h"
|
||||
|
||||
#define LEN 1024
|
||||
#define SIZE LEN<<2
|
||||
|
||||
int main(){
|
||||
int *A, *B;
|
||||
hipDeviceptr_t Ad, Bd;
|
||||
A = new int[LEN];
|
||||
B = new int[LEN];
|
||||
|
||||
for(int i=0;i<LEN;i++){
|
||||
A[i] = i;
|
||||
}
|
||||
|
||||
hipMalloc((void**)&Ad, SIZE);
|
||||
hipMalloc((void**)&Bd, SIZE);
|
||||
|
||||
hipMemcpyHtoD(Ad, A, SIZE);
|
||||
hipMemcpyDtoD(Bd, Ad, SIZE);
|
||||
hipMemcpyDtoH(B, Bd, SIZE);
|
||||
|
||||
for(int i=0;i<16;i++){
|
||||
std::cout<<A[i]<<" "<<B[i]<<std::endl;
|
||||
}
|
||||
|
||||
int *Ah, *Bh;
|
||||
hipHostMalloc(&Ah, SIZE, 0);
|
||||
hipHostMalloc(&Bh, SIZE, 0);
|
||||
memcpy(Ah, A, SIZE);
|
||||
hipStream_t stream;
|
||||
hipStreamCreate(&stream);
|
||||
|
||||
hipMemcpyHtoDAsync(Ad, Ah, SIZE, stream);
|
||||
hipStreamSynchronize(stream);
|
||||
hipMemcpyDtoDAsync(Bd, Ad, SIZE, stream);
|
||||
hipStreamSynchronize(stream);
|
||||
hipMemcpyDtoHAsync(Bh, Bd, SIZE, stream);
|
||||
hipStreamSynchronize(stream);
|
||||
|
||||
std::cout<<Ah[10]<<" "<<Bh[10]<<std::endl;
|
||||
}
|
||||
Reference in new issue
Block a user