-
Notifications
You must be signed in to change notification settings - Fork 76
install script for convinience to build and run tests #45
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
Merged
Merged
Changes from all commits
Commits
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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| #!/bin/bash | ||
|
|
||
|
|
||
| # ################################################# | ||
| # helper functions | ||
| # ################################################# | ||
| function display_help() | ||
| { | ||
| echo "rocPRIM build & installation helper script" | ||
| echo "./install [-h|--help] " | ||
| echo " [-h|--help] prints this help message" | ||
| echo " [-i|--install] install after build" | ||
| #Not implemented yet | ||
| # echo " [-d|--dependencies] install build dependencies" | ||
| echo " [-c|--clients] build library clients too (combines with -i & -d)" | ||
| echo " [-g|--debug] -DCMAKE_BUILD_TYPE=Debug (default is =Release)" | ||
| } | ||
|
|
||
|
|
||
| # ################################################# | ||
| # global variables | ||
| # ################################################# | ||
| install_package=false | ||
| build_clients=false | ||
| build_release=true | ||
| run_tests=false | ||
| rocm_path=/opt/rocm/bin | ||
| # ################################################# | ||
| # Parameter parsing | ||
| # ################################################# | ||
|
|
||
| # check if we have a modern version of getopt that can handle whitespace and long parameters | ||
| getopt -T | ||
| if [[ $? -eq 4 ]]; then | ||
| GETOPT_PARSE=$(getopt --name "${0}" --longoptions help,install,clients,debug,test --options hicdt -- "$@") | ||
| else | ||
| echo "Need a new version of getopt" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [[ $? -ne 0 ]]; then | ||
| echo "getopt invocation failed; could not parse the command line"; | ||
| exit 1 | ||
| fi | ||
|
|
||
| eval set -- "${GETOPT_PARSE}" | ||
|
|
||
|
|
||
| while true; do | ||
| case "${1}" in | ||
| -h|--help) | ||
| display_help | ||
| exit 0 | ||
| ;; | ||
| -i|--install) | ||
| install_package=true | ||
| shift ;; | ||
| -c|--clients) | ||
| build_clients=true | ||
| shift ;; | ||
| -g|--debug) | ||
| build_release=false | ||
| shift ;; | ||
| -t|--test) | ||
| run_tests=true | ||
| shift ;; | ||
| --) shift ; break ;; | ||
| *) echo "Unexpected command line parameter received; aborting"; | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
|
|
||
|
|
||
| # Go to rocPRIM directory, create and go to the build directory. | ||
| mkdir -p build; cd build | ||
|
|
||
| if ($build_release); then | ||
| mkdir -p release; cd release | ||
| else | ||
| mkdir -p debug; cd debug | ||
| fi | ||
|
|
||
| # Configure rocPRIM, setup options for your system. | ||
| # Build options: | ||
| # BUILD_TEST - on by default, | ||
| # BUILD_BENCHMARK - off by default. | ||
| # | ||
| # ! IMPORTANT ! | ||
| # On ROCm platform set C++ compiler to HCC. You can do it by adding 'CXX=<path-to-hcc>' | ||
| # before 'cmake' or setting cmake option 'CMAKE_CXX_COMPILER' to path to the HCC compiler. | ||
| # | ||
|
|
||
|
|
||
| CXX=$rocm_path/hcc cmake -DBUILD_BENCHMARK=ON ../../. # or cmake-gui ../. | ||
|
|
||
| # Build | ||
| make -j32 | ||
|
|
||
| if ($run_tests); then | ||
| # Optionally, run tests if they're enabled. | ||
| ctest --output-on-failure | ||
| fi | ||
|
|
||
| if ($install_package); then | ||
| # Install | ||
| make install | ||
| fi | ||
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.
maybe make -j$(nproc)?