Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[smoke] - Add hip-fopenmp test #1116

Open
wants to merge 1 commit into
base: aomp-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions test/smoke/hip-fopenmp/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
include ../../Makefile.defs

TESTNAME = hip-fopenmp
TESTSRC_MAIN = hip-fopenmp.cpp
TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
VERS = $(shell $(AOMP)/bin/clang --version | grep -oP '(?<=clang version )[0-9.]+')
ifeq ($(shell expr $(VERS) \>= 12.0), 1)
ifeq ($(AOMP_SANITIZER),1)
RPTH = -Wl,-rpath,$(AOMPHIP)/lib/asan
LLIB = -L$(AOMPHIP)/lib/asan
else
RPTH = -Wl,-rpath,$(AOMPHIP)/lib
LLIB = -L$(AOMPHIP)/lib
endif
endif
CLANG ?= clang++ -x hip -D__HIP_PLATFORM_AMD__=1 $(LLIB) -lamdhip64 $(RPTH) -I$(AOMPHIP)/include
OMP_BIN = $(AOMP)/bin/$(CLANG)
CC = $(OMP_BIN) $(VERBOSE)
#-ccc-print-phases
#"-\#\#\#"

include ../Makefile.rules
24 changes: 24 additions & 0 deletions test/smoke/hip-fopenmp/hip-fopenmp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <hip/hip_runtime.h>
#include <stdio.h>

// Testing hip compilation (-x hip) with -fopenmp. This should not pick up the openmp_wrappers/hip_host_overlay.h header. If it does then there will be an error:
// ld.lld: error: undefined symbol: omp_register_coarse_grain_mem
int main() {
constexpr int num_objects = 2;
void** buffers{nullptr};
hipError_t mallocResult = hipHostMalloc(&buffers, num_objects * sizeof(void*));
hipError_t freeResult = hipHostFree(buffers);
if (mallocResult != hipSuccess || freeResult != hipSuccess){
printf("Test failed in hipHostMalloc or hipHostFree \n");
return 1;
}

mallocResult = hipMalloc(&buffers, num_objects * sizeof(void*));
freeResult = hipFree(buffers);
if (mallocResult != hipSuccess || freeResult != hipSuccess){
printf("Test failed in hipMalloc or hipFree! \n");
return 1;
}
printf("Passed\n");
return 0;
}