Skip to content

Commit

Permalink
Reworking Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
bobrobey committed Sep 25, 2023
1 parent eb93ac2 commit 2dbeab8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
12 changes: 8 additions & 4 deletions Pragma_Examples/OpenMP/C/Make/reduction/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@ UNAMEP = $(shell uname -p)
ROCM_CPUTARGET = $(UNAMEP)-pc-linux-gnu
ROCM_GPUTARGET ?= amdgcn-amd-amdhsa

ifeq ($(notdir $(CC)), clang)
CC1=$(notdir $(CC))

ifeq ($(findstring clang,$(CC1)), clang)
# OPENMP_FLAGS = -fopenmp -target $(ROCM_CPUTARGET) -fopenmp-targets=$(ROCM_GPUTARGET) -Xopenmp-target=$(ROCM_GPUTARGET) -march=$(ROCM_GPU)
# Should work for > ROCm 4.5
OPENMP_FLAGS = -fopenmp -target $(ROCM_CPUTARGET) --offload-arch=$(ROCM_GPU)
else ifeq ($(notdir $(CC)), amdclang)
OPENMP_FLAGS = -fopenmp -target $(ROCM_CPUTARGET) --offload-arch=-march=$(ROCM_GPU)
else ifeq ($(findstring gcc,$(CC1)), gcc)
OPENMP_FLAGS = -fopenmp -foffload=amdgcn-amdhsa=-march=$(ROCM_GPU)
else ifeq ($(findstring amdclang,$(CC1)), amdclang)
# OPENMP_FLAGS = -fopenmp -target $(ROCM_CPUTARGET) -fopenmp-targets=$(ROCM_GPUTARGET) -Xopenmp-target=$(ROCM_GPUTARGET) -march=$(ROCM_GPU)
# Should work for > ROCm 4.5
OPENMP_FLAGS = -fopenmp -target $(ROCM_CPUTARGET) --offload-arch=$(ROCM_GPU)
else ifeq ($(notdir $(CC)), cc)
else ifeq ($(findstring cc,$(CC1)), cc)
OPENMP_FLAGS = -fopenmp
else
#OPENMP_FLAGS = --fopenmp -foffload=-march=${ROCM_GPU} -fopt-info-optimized-omp -fopt-info-missed
Expand Down
15 changes: 8 additions & 7 deletions Pragma_Examples/OpenMP/Fortran/Make/freduce/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ UNAMEP = $(shell uname -p)
ROCM_CPUTARGET = $(UNAMEP)-pc-linux-gnu
ROCM_GPUTARGET ?= amdgcn-amd-amdhsa

ifeq ($(notdir $(FC)), flang)
# OPENMP_FLAGS = -fopenmp -target $(ROCM_CPUTARGET) -fopenmp-targets=$(ROCM_GPUTARGET) -Xopenmp-target=$(ROCM_GPUTARGET) -march=$(ROCM_GPU)
# Should work for > ROCm 4.5
FC1=$(notdir $(FC))

ifeq ($(findstring amdflang,$(FC1)), amdflang)
OPENMP_FLAGS = -fopenmp -target $(ROCM_CPUTARGET) --offload-arch=$(ROCM_GPU)
FREE_FORM_FLAG = -Mfreeform
else ifeq ($(notdir $(FC)), amdflang)
# OPENMP_FLAGS = -fopenmp -target $(ROCM_CPUTARGET) -fopenmp-targets=$(ROCM_GPUTARGET) -Xopenmp-target=$(ROCM_GPUTARGET) -march=$(ROCM_GPU)
# Should work for > ROCm 4.5
else ifeq ($(findstring flang,$(FC1)), flang)
OPENMP_FLAGS = -fopenmp -target $(ROCM_CPUTARGET) --offload-arch=$(ROCM_GPU)
FREE_FORM_FLAG = -Mfreeform
else ifeq ($(notdir $(FC)), ftn)
else ifeq ($(findstring gfortran,$(FC1)), gfortran)
OPENMP_FLAGS = -fopenmp -foffload=amdgcn-amdhsa=-march=$(ROCM_GPU)
FREE_FORM_FLAG = -ffree-form
else ifeq ($(findstring ftn,$(FC1)), ftn)
OPENMP_FLAGS = -fopenmp
else
OPENMP_FLAGS = -fopenmp -foffload=-march=${ROCM_GPU} -fopt-info-optimized-omp
Expand Down

0 comments on commit 2dbeab8

Please sign in to comment.