Skip to content

Commit

Permalink
Merge pull request #143 from gcongiu/2023.12.19_rocm-smi-fix
Browse files Browse the repository at this point in the history
Fix for ROCm SMI
  • Loading branch information
gcongiu authored Dec 20, 2023
2 parents f1d5857 + 89793b0 commit b876424
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/components/rocm/tests/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
NAME = rocm
include ../../Makefile_comp_tests.target
PAPI_ROCM_ROOT ?= /opt/rocm
HIP_PATH ?= $(PAPI_ROCM_ROOT)/hip

CC = $(HIP_PATH)/bin/hipcc
CXX = $(HIP_PATH)/bin/hipcc
HIPCC = $(shell find $(PAPI_ROCM_ROOT) -iname hipcc | grep bin | head -n 1)
CC = $(HIPCC)
CXX = $(HIPCC)
CPPFLAGS+= -I$(PAPI_ROCM_ROOT)/include \
-I$(PAPI_ROCM_ROOT)/include/hip \
-I$(PAPI_ROCM_ROOT)/include/hsa \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ static void *run(void *thread_num_arg)
}

hipStream_t stream;
hipSetDevice(thread_num);
hipError_t hip_errno = hipStreamCreate(&stream);
hipError_t hip_errno = hipSetDevice(thread_num);
if (hip_errno != hipSuccess) {
hip_test_fail(__FILE__, __LINE__, "hipSetDevice", hip_errno);
}

hip_errno = hipStreamCreate(&stream);
if (hip_errno != hipSuccess) {
hip_test_fail(__FILE__, __LINE__, "hipStreamCreate", hip_errno);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ int main(int argc, char *argv[])
}

hipStream_t stream;
hipSetDevice(0);
hip_errno = hipSetDevice(0);
if (hip_errno != hipSuccess) {
hip_test_fail(__FILE__, __LINE__, "hipSetDevice", hip_errno);
}

hip_errno = hipStreamCreate(&stream);
if (hip_errno != hipSuccess) {
hip_test_fail(__FILE__, __LINE__, "hipStreamCreate", hip_errno);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ static void *run(void *thread_num_arg)
{
int thread_num = *(int *) thread_num_arg;
hipStream_t stream;
hipSetDevice(thread_num);
hipError_t hip_errno = hipStreamCreate(&stream);
hipError_t hip_errno = hipSetDevice(thread_num);
if (hip_errno != hipSuccess) {
hip_test_fail(__FILE__, __LINE__, "hipSetDevice", hip_errno);
}

hip_errno = hipStreamCreate(&stream);
if (hip_errno != hipSuccess) {
hip_test_fail(__FILE__, __LINE__, "hipStreamCreate", hip_errno);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ int main(int argc, char *argv[])
}

hipStream_t stream;
hipSetDevice(0);
hip_errno = hipSetDevice(0);
if (hip_errno != hipSuccess) {
hip_test_fail(__FILE__, __LINE__, "hipSetDevice", hip_errno);
}

hip_errno = hipStreamCreate(&stream);
if (hip_errno != hipSuccess) {
hip_test_fail(__FILE__, __LINE__, "hipStreamCreate", hip_errno);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ static void *run(void *thread_num_arg)
{
int thread_num = *(int *) thread_num_arg;
hipStream_t stream;
hipSetDevice(thread_num);
hipError_t hip_errno = hipStreamCreate(&stream);
hipError_t hip_errno = hipSetDevice(thread_num);
if (hip_errno != hipSuccess) {
hip_test_fail(__FILE__, __LINE__, "hipSetDevice", hip_errno);
}

hip_errno = hipStreamCreate(&stream);
if (hip_errno != hipSuccess) {
hip_test_fail(__FILE__, __LINE__, "hipStreamCreate", hip_errno);
}
Expand Down
12 changes: 6 additions & 6 deletions src/components/rocm/tests/matmul.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ void
hip_do_matmul_cleanup(void **handle)
{
struct memory *handle_p = (struct memory *) (*handle);
hipFree(handle_p->h_A);
hipFree(handle_p->h_B);
hipFree(handle_p->h_C);
hipFree(handle_p->d_A);
hipFree(handle_p->d_B);
hipFree(handle_p->d_C);
(void)hipFree(handle_p->h_A);
(void)hipFree(handle_p->h_B);
(void)hipFree(handle_p->h_C);
(void)hipFree(handle_p->d_A);
(void)hipFree(handle_p->d_B);
(void)hipFree(handle_p->d_C);
free(handle_p);
*handle = NULL;
}
2 changes: 1 addition & 1 deletion src/configure
Original file line number Diff line number Diff line change
Expand Up @@ -7167,7 +7167,7 @@ for comp in $components; do
CFLAGS="$CFLAGS -DHAVE_ROCM"
fi
if test "x`find $PAPI_ROCM_ROOT -name "rocm_smi.h"`" != "x" ; then
if test "x`find $PAPI_ROCMSMI_ROOT -name "rocm_smi.h"`" != "x" ; then
CFLAGS="$CFLAGS -DHAVE_ROCM_SMI"
fi
fi
Expand Down
2 changes: 1 addition & 1 deletion src/configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -2051,7 +2051,7 @@ for comp in $components; do
CFLAGS="$CFLAGS -DHAVE_ROCM"
fi

if test "x`find $PAPI_ROCM_ROOT -name "rocm_smi.h"`" != "x" ; then
if test "x`find $PAPI_ROCMSMI_ROOT -name "rocm_smi.h"`" != "x" ; then
CFLAGS="$CFLAGS -DHAVE_ROCM_SMI"
fi
fi
Expand Down

0 comments on commit b876424

Please sign in to comment.