Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
SWDEV-385161 - Deprecate/Remove env vars such as HIP_PATH, HSA_PATH etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
satyanveshd committed Mar 9, 2023
1 parent 11372c9 commit 8aa123c
Show file tree
Hide file tree
Showing 24 changed files with 124 additions and 38 deletions.
4 changes: 3 additions & 1 deletion HIP-Examples-Applications/BinomialOption/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
HIPCC=/opt/rocm/bin/hipcc
HIP_PATH?= $(wildcard /opt/rocm)
HIPCC=$(HIP_PATH)/bin/hipcc

SOURCES = BinomialOption.cpp
OBJECTS = $(SOURCES:.cpp=.o)
Expand All @@ -25,3 +26,4 @@ test: $(EXECUTABLE)
clean:
rm -f $(EXECUTABLE)
rm -f $(OBJECTS)
rm -f $(HIP_PATH)/src/*.o
4 changes: 3 additions & 1 deletion HIP-Examples-Applications/BitonicSort/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
HIPCC=/opt/rocm/bin/hipcc
HIP_PATH?= $(wildcard /opt/rocm)
HIPCC=$(HIP_PATH)/bin/hipcc

SOURCES = BitonicSort.cpp
OBJECTS = $(SOURCES:.cpp=.o)
Expand All @@ -25,3 +26,4 @@ test: $(EXECUTABLE)
clean:
rm -f $(EXECUTABLE)
rm -f $(OBJECTS)
rm -f $(HIP_PATH)/src/*.o
4 changes: 3 additions & 1 deletion HIP-Examples-Applications/FastWalshTransform/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
HIPCC=/opt/rocm/bin/hipcc
HIP_PATH?= $(wildcard /opt/rocm)
HIPCC=$(HIP_PATH)/bin/hipcc

SOURCES = FastWalshTransform.cpp
OBJECTS = $(SOURCES:.cpp=.o)
Expand All @@ -25,3 +26,4 @@ test: $(EXECUTABLE)
clean:
rm -f $(EXECUTABLE)
rm -f $(OBJECTS)
rm -f $(HIP_PATH)/src/*.o
4 changes: 3 additions & 1 deletion HIP-Examples-Applications/FloydWarshall/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
HIPCC=/opt/rocm/bin/hipcc
HIP_PATH?= $(wildcard /opt/rocm)
HIPCC=$(HIP_PATH)/bin/hipcc

SOURCES = FloydWarshall.cpp
OBJECTS = $(SOURCES:.cpp=.o)
Expand All @@ -25,3 +26,4 @@ test: $(EXECUTABLE)
clean:
rm -f $(EXECUTABLE)
rm -f $(OBJECTS)
rm -f $(HIP_PATH)/src/*.o
6 changes: 3 additions & 3 deletions HIP-Examples-Applications/HelloWorld/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
HIPCC=/opt/rocm/bin/hipcc

TARGET=hcc
HIP_PATH?= $(wildcard /opt/rocm)
HIPCC=$(HIP_PATH)/bin/hipcc

SOURCES = HelloWorld.cpp
OBJECTS = $(SOURCES:.cpp=.o)
Expand All @@ -27,3 +26,4 @@ test: $(EXECUTABLE)
clean:
rm -f $(EXECUTABLE)
rm -f $(OBJECTS)
rm -f $(HIP_PATH)/src/*.o
4 changes: 3 additions & 1 deletion HIP-Examples-Applications/Histogram/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
HIPCC=/opt/rocm/bin/hipcc
HIP_PATH?= $(wildcard /opt/rocm)
HIPCC=$(HIP_PATH)/bin/hipcc

SOURCES = Histogram.cpp
OBJECTS = $(SOURCES:.cpp=.o)
Expand All @@ -25,3 +26,4 @@ test: $(EXECUTABLE)
clean:
rm -f $(EXECUTABLE)
rm -f $(OBJECTS)
rm -f $(HIP_PATH)src/*.o
4 changes: 3 additions & 1 deletion HIP-Examples-Applications/MatrixMultiplication/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
HIPCC=/opt/rocm/bin/hipcc
HIP_PATH?= $(wildcard /opt/rocm)
HIPCC=$(HIP_PATH)/bin/hipcc

SOURCES = MatrixMultiplication.cpp
OBJECTS = $(SOURCES:.cpp=.o)
Expand All @@ -25,3 +26,4 @@ test: $(EXECUTABLE)
clean:
rm -f $(EXECUTABLE)
rm -f $(OBJECTS)
rm -f $(HIP_PATH)/src/*.o
4 changes: 3 additions & 1 deletion HIP-Examples-Applications/PrefixSum/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
HIPCC=/opt/rocm/bin/hipcc
HIP_PATH?= $(wildcard /opt/rocm)
HIPCC=$(HIP_PATH)/bin/hipcc

SOURCES = PrefixSum.cpp
OBJECTS = $(SOURCES:.cpp=.o)
Expand All @@ -25,3 +26,4 @@ test: $(EXECUTABLE)
clean:
rm -f $(EXECUTABLE)
rm -f $(OBJECTS)
rm -f $(HIP_PATH)/src/*.o
4 changes: 3 additions & 1 deletion HIP-Examples-Applications/RecursiveGaussian/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
HIPCC=/opt/rocm/bin/hipcc
HIP_PATH?= $(wildcard /opt/rocm)
HIPCC=$(HIP_PATH)/bin/hipcc

SOURCES = RecursiveGaussian.cpp
OBJECTS = $(SOURCES:.cpp=.o)
Expand All @@ -25,3 +26,4 @@ test: $(EXECUTABLE)
clean:
rm -f $(EXECUTABLE)
rm -f $(OBJECTS)
rm -f $(HIP_PATH)/src/*.o
4 changes: 3 additions & 1 deletion HIP-Examples-Applications/SimpleConvolution/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
HIPCC=/opt/rocm/bin/hipcc
HIP_PATH?= $(wildcard /opt/rocm)
HIPCC=$(HIP_PATH)/bin/hipcc

SOURCES = SimpleConvolution.cpp
OBJECTS = $(SOURCES:.cpp=.o)
Expand All @@ -25,3 +26,4 @@ test: $(EXECUTABLE)
clean:
rm -f $(EXECUTABLE)
rm -f $(OBJECTS)
rm -f $(HIP_PATH)/src/*.o
4 changes: 3 additions & 1 deletion add4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ all: gpu-stream-hip

common.o: common.cpp common.h Makefile

HIPCC=/opt/rocm/bin/hipcc
HIP_PATH?= $(wildcard /opt/rocm)

HIPCC=$(HIP_PATH)/bin/hipcc

hip-stream.o : hip-stream.cpp
$(HIPCC) $(CXXFLAGS) -c $< -o $@
Expand Down
4 changes: 2 additions & 2 deletions common/hip.all.make
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include /opt/rocm/hip/examples/common/hip.prologue.make
include /opt/rocm/hip/examples/common/hip.epilogue.make
include $(HIP_PATH)/examples/common/hip.prologue.make
include $(HIP_PATH)/examples/common/hip.epilogue.make
19 changes: 14 additions & 5 deletions common/hip.prologue.make
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# This file is designed to be included at beginning of Makefile.
# This file is designed to be included at beginning of Makefile, right after setting HIP_PATH.
# Note: define $HIP_PATH before including this file.
# HIP_PATH should be relevant to the parent makefile
#
# It should not include any concrete makefile steps, so "make" still runs the first step in the Makefile.
#

#------
##Provide default if not already set:
HIP_PLATFORM=$(shell /opt/rocm/bin/hipconfig --compiler)
HIP_PATH?=../..
HIP_PLATFORM=$(shell $(HIP_PATH)/bin/hipconfig --compiler)

# CUDA toolkit installation path
CUDA_DIR?=/usr/local/cuda-7.5
Expand All @@ -22,11 +25,13 @@ endif
# nvcc (7.5) can handle openmp though.
# use OMPCC and OMP_FLAGS

HIPCC=/opt/rocm/bin/hipcc
HIPLD=/opt/rocm/bin/hipcc
HIPCC=$(HIP_PATH)/bin/hipcc
HIPLD=$(HIP_PATH)/bin/hipcc

#--
# Set up automatic make of HIP cpp depenendencies
# TODO - this can be removed when HIP has a proper make structure.
#HIP_SOURCES = $(HIP_PATH)/src/hip_hcc.cpp

HIPCC_FLAGS += -I../../common
# 'make dbg=1' enables HIPCC debugging and no opt switch.
Expand All @@ -50,11 +55,15 @@ OMP_FLAGS = $(HIPCC_FLAGS)
HIP_DEPS =

else ifeq ($(HIP_PLATFORM), hcc)
#HIP_DEPS = $(HIP_SOURCES:.cpp=.o)
OMPCC = gcc
OMP_FLAGS += -fopenmp

# Add dependencies to make hip_cc.o and other support files.
HSA_PATH ?= /opt/hsa
#HIP_SOURCES = $(HIP_PATH)/src/hip_hcc.cpp
#HIP_DEPS = $(HIP_SOURCES:.cpp=.o)
#$(HIP_DEPS): HIPCC_FLAGS += -I$(HSA_PATH)/include
%.o:: %.cpp
$(HIPCC) $(HIPCC_FLAGS) $< -c -o $@
endif
Expand All @@ -76,7 +85,7 @@ endif
# $(HIPIFY) $< > $@


KCFLAGS += $(OPT) -I/opt/rocm/include -I/opt/rocm/hip/include -I$(GRID_LAUNCH_PATH) -I$(AM_PATH)/include
KCFLAGS += $(OPT) -I$(HSA_PATH)/include -I$(HIP_PATH)/include -I$(GRID_LAUNCH_PATH) -I$(AM_PATH)/include

%.o:: %.cpp
$(HIPCC) $(HIPCC_FLAGS) $< -c -o $@
Expand Down
4 changes: 3 additions & 1 deletion cuda-stream/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
HIPCC=/opt/rocm/bin/hipcc
HIP_PATH?= $(wildcard /opt/rocm)

HIPCC=$(HIP_PATH)/bin/hipcc

CXXFLAGS += -std=c++11 -O3

Expand Down
8 changes: 5 additions & 3 deletions gpu-burn/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
HIP_PLATFORM = $(shell /opt/rocm/bin/hipconfig --platform)
HIP_INCLUDE = -I/opt/rocm/include
HIP_PATH?= $(wildcard /opt/rocm)

HIP_PLATFORM = $(shell $(HIP_PATH)/bin/hipconfig --platform)
HIP_INCLUDE = -I$(HIP_PATH)/include
BUILD_DIR ?= build

HIPCC = /opt/rocm/bin/hipcc
HIPCC = $(HIP_PATH)/bin/hipcc
CPPFLAGS = -O3
LDFLAGS = -lm -lpthread

Expand Down
15 changes: 14 additions & 1 deletion mini-nbody/hip/HIP-nbody-block.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,20 @@ then
rm nbody-block
fi

if [ -z "$HIP_PATH" ]
then

if [ -d /opt/rocm/hip ]
then
HIP_PATH=/opt/rocm/hip
else
HIP_PATH=/opt/rocm
fi

fi

echo hipcc -I../ -DSHMOO nbody-block.cpp -o nbody-block
/opt/rocm/bin/hipcc -I../ -DSHMOO nbody-block.cpp -o nbody-block
$HIP_PATH/bin/hipcc -I../ -DSHMOO nbody-block.cpp -o nbody-block

#To print our more details, remove DSHMOO flag
#hipcc -I../ nbody-block.cpp -o nbody-block
Expand All @@ -25,3 +37,4 @@ do
./$EXE $K
K=$(($K*2))
done

15 changes: 14 additions & 1 deletion mini-nbody/hip/HIP-nbody-orig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,20 @@ then
rm nbody-orig
fi

if [ -z "$HIP_PATH" ]
then

if [ -d /opt/rocm/hip ]
then
HIP_PATH=/opt/rocm/hip
else
HIP_PATH=/opt/rocm
fi

fi

echo hipcc -I../ -DSHMOO nbody-orig.cpp -o nbody-orig
/opt/rocm/bin/hipcc -I../ -DSHMOO nbody-orig.cpp -o nbody-orig
$HIP_PATH/bin/hipcc -I../ -DSHMOO nbody-orig.cpp -o nbody-orig

#To print our more details, remove flag
#hipcc -I../ nbody-orig.cpp -o nbody-orig
Expand All @@ -23,3 +35,4 @@ do
./$EXE $K
K=$(($K*2))
done

15 changes: 14 additions & 1 deletion mini-nbody/hip/HIP-nbody-soa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,20 @@ then
rm nbody-soa
fi

if [ -z "$HIP_PATH" ]
then

if [ -d /opt/rocm/hip ]
then
HIP_PATH=/opt/rocm/hip
else
HIP_PATH=/opt/rocm
fi

fi

echo hipcc -I../ -DSHMOO nbody-soa.cpp -o nbody-soa
/opt/rocm/bin/hipcc -I../ -DSHMOO nbody-soa.cpp -o nbody-soa
$HIP_PATH/bin/hipcc -I../ -DSHMOO nbody-soa.cpp -o nbody-soa

#To print our more details, remove DSHMOO flag
#hipcc -I../ nbody-soa.cpp -o nbody-soa
Expand All @@ -25,3 +37,4 @@ do
./$EXE $K
K=$(($K*2))
done

4 changes: 3 additions & 1 deletion openmp-helloworld/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
HIPCC=/opt/rocm/bin/hipcc
HIP_PATH?= $(wildcard /opt/rocm)
HIPCC=$(HIP_PATH)/bin/hipcc

CXX=$(HIPCC)
CXXFLAGS =-fopenmp

Expand Down
4 changes: 2 additions & 2 deletions reduction/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
HIPCC=/opt/rocm/bin/hipcc
HIP_PATH?= $(wildcard /opt/rocm)
HIPCC=$(HIP_PATH)/bin/hipcc

CXXFLAGS += -std=c++11 -O3

Expand All @@ -13,4 +14,3 @@ endif

clean:
rm -f reduction *.o

4 changes: 2 additions & 2 deletions rtm8/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
HIPCC=/opt/rocm/bin/hipcc
HIP_PATH?= $(wildcard /opt/rocm)
HIPCC=$(HIP_PATH)/bin/hipcc

CXXFLAGS += -std=c++11 -O3

Expand All @@ -13,4 +14,3 @@ endif

clean:
rm -f rtm8 *.o

14 changes: 13 additions & 1 deletion rtm8/build_hip.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
#!/bin/bash

if [ -z "$HIP_PATH" ]
then

if [ -d /opt/rocm/hip ]
then
HIP_PATH=/opt/rocm/hip
else
HIP_PATH=/opt/rocm
fi

fi

if [ -f "rtm8_hip" ]
then
rm rtm8_hip
fi

echo "hipcc -std=c++11 -O3 -o rtm8_hip rtm8.cpp"
/opt/rocm/bin/hipcc -std=c++11 -O3 -o rtm8_hip rtm8.cpp
$HIP_PATH/bin/hipcc -std=c++11 -O3 -o rtm8_hip rtm8.cpp

4 changes: 2 additions & 2 deletions strided-access/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
HIPCC=/opt/rocm/bin/hipcc
HIP_PATH?= $(wildcard /opt/rocm)
HIPCC=$(HIP_PATH)/bin/hipcc

CXXFLAGS += -std=c++11 -O3

Expand All @@ -13,4 +14,3 @@ endif

clean:
rm -f strided-access *.o

6 changes: 3 additions & 3 deletions vectorAdd/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
HIPCC=/opt/rocm/bin/hipcc

TARGET=hcc
HIP_PATH?= $(wildcard /opt/rocm)
HIPCC=$(HIP_PATH)/bin/hipcc

SOURCES = vectoradd_hip.cpp
OBJECTS = $(SOURCES:.cpp=.o)
Expand Down Expand Up @@ -28,3 +27,4 @@ test: $(EXECUTABLE)
clean:
rm -f $(EXECUTABLE)
rm -f $(OBJECTS)
rm -f $(HIP_PATH)/src/*.o

0 comments on commit 8aa123c

Please sign in to comment.