hipHostRegister and hipHostMalloc refactor.
Note hipHostMalloc (not hipHostAlloc or hipMallocHost).
- the hipHost* is used for all HIP APIs dealing with Host memory.
(including hipHostMalloc, hipHostFree, hipHostRegister,
hipHostUnregister, hipHostGetFlags, hipHostGetDevicePointer).
- hipMallocHost is consistent with "hipMalloc" for allocating device
memory. Enumerations hipHostMalloc* also used as optional
flags parm to hipHostMalloc.
This commit is contained in:
@@ -35,9 +35,9 @@ int main(){
|
||||
float *A, *B, *C, *D;
|
||||
float *Ad, *Bd, *Cd, *Dd;
|
||||
unsigned int FlagA, FlagB, FlagC;
|
||||
FlagA = hipHostAllocWriteCombined | hipHostAllocMapped;
|
||||
FlagB = hipHostAllocWriteCombined | hipHostAllocMapped;
|
||||
FlagC = hipHostAllocMapped;
|
||||
FlagA = hipHostMallocWriteCombined | hipHostMallocMapped;
|
||||
FlagB = hipHostMallocWriteCombined | hipHostMallocMapped;
|
||||
FlagC = hipHostMallocMapped;
|
||||
hipDeviceProp_t prop;
|
||||
int device;
|
||||
HIPCHECK(hipGetDevice(&device));
|
||||
@@ -45,11 +45,11 @@ HIPCHECK(hipGetDeviceProperties(&prop, device));
|
||||
if(prop.canMapHostMemory != 1){
|
||||
std::cout<<"Exiting..."<<std::endl;
|
||||
}
|
||||
HIPCHECK(hipHostAlloc((void**)&A, SIZE, hipHostAllocWriteCombined | hipHostAllocMapped));
|
||||
HIPCHECK(hipHostAlloc((void**)&B, SIZE, hipHostAllocWriteCombined | hipHostAllocMapped));
|
||||
HIPCHECK(hipHostAlloc((void**)&C, SIZE, hipHostAllocMapped));
|
||||
HIPCHECK(hipHostMalloc((void**)&A, SIZE, hipHostMallocWriteCombined | hipHostMallocMapped));
|
||||
HIPCHECK(hipHostMalloc((void**)&B, SIZE, hipHostMallocWriteCombined | hipHostMallocMapped));
|
||||
HIPCHECK(hipHostMalloc((void**)&C, SIZE, hipHostMallocMapped));
|
||||
|
||||
HIPCHECK(hipHostAlloc((void**)&D, SIZE, hipHostAllocDefault));
|
||||
HIPCHECK(hipHostMalloc((void**)&D, SIZE, hipHostMallocDefault));
|
||||
|
||||
unsigned int flagA, flagB, flagC;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user