-
Notifications
You must be signed in to change notification settings - Fork 19
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
Feature/mac os install inst #3
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,114 @@ | ||
**TODO** | ||
# Building the HIP CPU Runtime and Client Applications GCC C++ # | ||
|
||
This tutorial shows how to use the GCC C++ Compiler on MacOS to | ||
build the HIP CPU Runtime. It does not delve into the details of HIP, the | ||
C++ language, the GCC toolset or the MacOS ecosystem. | ||
|
||
If you encounter any difficulties, [please create an issue](https://github.com/ROCm-Developer-Tools/HIP-CPU/issues/new/choose) | ||
for this tutorial. | ||
|
||
## Prerequisites ## | ||
|
||
To successfully complete this tutorial, the following steps are necessary: | ||
|
||
1. Install [Homebrew](https://brew.sh): | ||
- LLVM at the moment does not have parallel algorithm support. However, | ||
it is available in GNU G++. Homebrew provides a straightforward package | ||
manager for MacOS, which allows both the GNU G++ compiler, and Intel | ||
TBB on which HIP-CPU depends. One can also consider other package managers | ||
such as MacPorts, but we will focus on Homebrew here. | ||
|
||
- go to [The Homebrew Site](https://brew.sh) and follow the installation | ||
instructions there: | ||
```bash | ||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | ||
``` | ||
You may or may not get messages about needing to install the XCode command line | ||
utilities if these are not yet installed. Follow the appropriate installation | ||
instructions on the Homebrew site. | ||
|
||
2. Install [GNU G++][(https://gcc.gnu.org) | ||
- Using Homebrew: | ||
```bash | ||
brew install gcc@10 | ||
``` | ||
- to avoid confusion with the system GCC (which is actually Clang), homebrew will name the | ||
executables as gcc-10 and g++-10 | ||
|
||
3. Install [Intel TBB](https://github.com/oneapi-src/oneTBB): | ||
- At this time this is a pre-requisite for HIP-CPU(makefiles depend on it) | ||
as it used to be a prerequisite for parallel algorithms for G++ on Linux. | ||
Under MacOS, with the Homebrew installation, I successfully compiled a simple | ||
parallel C++-17 parallel algorithm test from [here](https://solarianprogrammer.com/2019/05/09/cpp-17-stl-parallel-algorithms-gcc-intel-tbb-linux-macos/) | ||
without TBB. However it is very easy to install using Homebrew: | ||
```bash | ||
brew install tbb | ||
``` | ||
|
||
2. Install latest CMake | ||
- Homebrew makes this super easy also: | ||
```bash | ||
brew install cmake | ||
``` | ||
|
||
- Alternatively, [download and execute the installer](https://cmake.org/download/). | ||
3. Install Git | ||
- This can be done from Homebrew: | ||
```bash | ||
brew install git | ||
``` | ||
- alternatively a Git client can be installed from [The Git Website](https://git-scm.com)` | ||
|
||
Ensure that `/usr/local/bin` is on your PATH -- this is where Homebrew installs all its tools. | ||
|
||
## Ensure GCC is Installed ## | ||
|
||
To verify whether GCC is installed and of a sufficiently recent version, open a | ||
Terminal window and enter the following command: | ||
|
||
```bash | ||
gcc-10 -v | ||
``` | ||
|
||
## Clone and build the HIP CPU Runtime ## | ||
|
||
```bash | ||
git clone https://github.com/ROCm-Developer-Tools/HIP-CPU.git | ||
cd HIP-CPU | ||
mkdir build | ||
cd build | ||
cmake -DCMAKE_CXX_COMPILER=g++-10 ,,/ | ||
cmake --build ./ | ||
``` | ||
|
||
If you want to later install the HIP CPU Runtime in non standard folder you can | ||
specify the install location to the `cmake` command | ||
|
||
```bash | ||
cmake -DCMAKE_CXX_COMPILER=g++-10 -DCMAKE_INSTALL_PREFIX=<location to install the runtime> | ||
``` | ||
|
||
## **OPTIONAL** Install the HIP CPU Runtime ## | ||
|
||
```bash | ||
# Assumes that you are in the build folder created in the build step. | ||
cmake --build ./ --target install | ||
``` | ||
|
||
## Verify the build by running the unit tests ## | ||
|
||
```bash | ||
# Assumes that you are in the build folder created in the build step. | ||
ctest --output-on-failure | ||
``` | ||
|
||
## Use the HIP CPU Runtime in your code ## | ||
|
||
To use any of the HIP public interfaces include the `hip/hip_runtime.h` header. | ||
|
||
- If you are working with CMake, link against the convenience `INTERFACE` target | ||
`hip_cpu_rt::hip_cpu_rt`, which is exported by the HIP CPU Runtime, which can | ||
be queried by `find_package(hip_cpu_rt)`; | ||
- If you are not working with CMake, add either | ||
`/path_where_you_cloned_the_hip_cpu_runtime/include` or, if you installed it, | ||
`/path_where_you_installed_the_hip_cpu_runtime/include` to your include path. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we can separate the investigation into whether or not TBB is required on macOS into a separate issue? It's ideal to have as few dependencies as possible, but the wording here could confuse users into believing that libstdc++ no longer depends on TBB in general, which is not quite yet the case as far as I can tell.