Revert "Merge branch 'amd-master-next' into amd-npi-next"
This reverts commit 73558e3363.
Reason for revert: <INSERT REASONING HERE>
Change-Id: I53322718dadde2c98f96140b8e260ec7ee9ef721
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
#Follow "README.md" to generate square.cpp if it's missing
|
||||
|
||||
project(square)
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
# Search for rocm in common locations
|
||||
list(APPEND CMAKE_PREFIX_PATH /opt/rocm/hip /opt/rocm)
|
||||
|
||||
# Find hip
|
||||
find_package(hip)
|
||||
|
||||
# Set compiler and linker
|
||||
set(CMAKE_CXX_COMPILER ${HIP_HIPCC_EXECUTABLE})
|
||||
set(CMAKE_CXX_LINKER ${HIP_HIPCC_EXECUTABLE})
|
||||
|
||||
# Create the excutable
|
||||
add_executable(square square.cpp)
|
||||
|
||||
# Link with HIP
|
||||
target_link_libraries(square hip::host)
|
||||
@@ -11,7 +11,7 @@ else
|
||||
SOURCES=square.cpp
|
||||
endif
|
||||
|
||||
all: square.out
|
||||
all: square.out square.out.static
|
||||
|
||||
# Step
|
||||
square.cpp: square.cu
|
||||
@@ -20,5 +20,8 @@ square.cpp: square.cu
|
||||
square.out: $(SOURCES)
|
||||
$(HIPCC) $(CXXFLAGS) $(SOURCES) -o $@
|
||||
|
||||
square.out.static: $(SOURCES)
|
||||
$(HIPCC) -use-staticlib $(CXXFLAGS) $(SOURCES) -o $@
|
||||
|
||||
clean:
|
||||
rm -f *.o *.out square.cpp
|
||||
rm -f *.o *.out *.out.static square.cpp
|
||||
|
||||
@@ -1,39 +1,13 @@
|
||||
# Square.md
|
||||
|
||||
Simple test which shows how to use hipify-perl to port CUDA code to HIP.
|
||||
See related [blog](http://gpuopen.com/hip-to-be-squared-an-introductory-hip-tutorial) that explains the example.
|
||||
Simple test which shows how to use hipify-perl to port CUDA code to HIP.
|
||||
See related [blog](http://gpuopen.com/hip-to-be-squared-an-introductory-hip-tutorial) that explains the example.
|
||||
Now it is even simpler and requires no manual modification to the hipified source code - just hipify and compile:
|
||||
|
||||
- Add hip/bin path to the PATH
|
||||
1. Add hip/bin path to the PATH :
|
||||
<code>export PATH=$PATH:[MYHIP]/bin</code>
|
||||
|
||||
```
|
||||
$ export PATH=$PATH:[MYHIP]/bin
|
||||
```
|
||||
|
||||
- Define environment variable
|
||||
|
||||
```
|
||||
$ export HIP_PATH=[MYHIP]
|
||||
```
|
||||
|
||||
- Build executible file
|
||||
|
||||
```
|
||||
$ cd ~/hip/samples/0_Intro/square
|
||||
$ make
|
||||
/home/user/hip/bin/hipify-perl square.cu > square.cpp
|
||||
/home/user/hip/bin/hipcc square.cpp -o square.out
|
||||
/home/user/hip/bin/hipcc -use-staticlib square.cpp -o square.out.static
|
||||
```
|
||||
- Execute file
|
||||
```
|
||||
$ ./square.out
|
||||
info: running on device Navi 14 [Radeon Pro W5500]
|
||||
info: allocate host mem ( 7.63 MB)
|
||||
info: allocate device mem ( 7.63 MB)
|
||||
info: copy Host2Device
|
||||
info: launch 'vector_square' kernel
|
||||
info: copy Device2Host
|
||||
info: check result
|
||||
PASSED!
|
||||
```
|
||||
2. <code>$ make </code>
|
||||
Make runs these steps. This can be performed on either CUDA or AMD platform:
|
||||
<code>hipify-perl square.cu > square.cpp </code> # convert cuda code to hip code
|
||||
<code>hipcc square.cpp</code> # compile into executable
|
||||
|
||||
Reference in New Issue
Block a user