Skip to content

Commit

Permalink
fix compilation issues; success on AMD MI-250X
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Knight committed Feb 27, 2025
1 parent 9cda537 commit 0ed6429
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
18 changes: 18 additions & 0 deletions gpu/src/arch/jlse-amd-mi250
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
INSTALL = ../../my_pyscf/gpu

PYTHON_INC=$(shell python -m pybind11 --includes)

CXX = hipcc
CXXFLAGS = -g -fopenmp -O2
CXXFLAGS += -I$(ROCM_PATH)/include/hip -I$(ROCM_PATH)/include/hipblas
CXXFLAGS += $(PYTHON_INC)

CXXFLAGS += -D_USE_GPU -D_GPU_HIP -D_GPU_HIPBLAS
CXXFLAGS += -Wno-unused-result

LD = $(CXX)
LDFLAGS = $(CXXFLAGS)

LIB = -lstdc++
LIB += /home/knightc/projects/LASSCF_gpudev/soft/openblas/lib/libopenblas.so
LIB += -L$(ROCM_PATH)/lib -lhipblas
3 changes: 3 additions & 0 deletions gpu/src/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@ public :
#if defined _GPU_CUBLAS
cublasHandle_t handle;
cudaStream_t stream;
#elif defined _GPU_HIPBLAS
hipblasHandle_t handle;
hipStream_t stream;
#elif defined _GPU_MKL
int * handle;
sycl::queue * stream;
Expand Down
2 changes: 1 addition & 1 deletion gpu/src/mathlib/mathlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#elif defined(_GPU_MKL)
#include "mathlib_mkl.h"
#elif defined(_GPU_HIPBLAS)
#include "hipblas.h"
#include "mathlib_hipblas.h"
#endif

#elif defined(_USE_CPU)
Expand Down
8 changes: 4 additions & 4 deletions gpu/src/pm/pm_hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,16 @@ void PM::dev_properties(int ndev)
#endif

for(int i=0; i<ndev; ++i) {
hipDeviceProp prop;
hipDeviceProp_t prop;
hipGetDeviceProperties(&prop, i);
_HIP_CHECK_ERRORS();

char name[256];
strcpy(name, prop.name);

printf("LIBGPU :: [%i] Platform[ Nvidia ] Type[ GPU ] Device[ %s ] uuid= ", i, name);
printf("LIBGPU :: [%i] Platform[ AMD ] Type[ GPU ] Device[ %s ] uuid= ", i, name);
uuid_print(prop.uuid);
printf("\n");
//printf("\n");
}

#ifdef _DEBUG_PM
Expand Down Expand Up @@ -393,7 +393,7 @@ void PM::dev_check_pointer(int rnk, const char * name, void * ptr)
printf("Inside PM::dev_check_pointer()\n");
#endif

hipPointerAttributes attributes;
hipPointerAttribute_t attributes;
hipPointerGetAttributes(&attributes, ptr);
if(attributes.devicePointer != NULL) printf("(%i) ptr %s is devicePointer\n",rnk,name);
if(attributes.hostPointer != NULL) printf("(%i) ptr %s is hostPointer\n",rnk,name);
Expand Down
4 changes: 2 additions & 2 deletions gpu/src/pm/pm_hip.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace PM_NS {

#define _HIP_CHECK_ERRORS() \
{ \
hipError err = hipGetLastError(); \
hipError_t err = hipGetLastError(); \
if(err != hipSuccess) { \
std::cout \
<< "HIP error with code " \
Expand All @@ -30,7 +30,7 @@ namespace PM_NS {

#define _HIP_CHECK_ERRORS2() \
{ \
hipError err = hipGetLastError(); \
hipError_t err = hipGetLastError(); \
if(err != hipSuccess) { \
std::cout \
<< "HIP error with code " \
Expand Down

0 comments on commit 0ed6429

Please sign in to comment.