-
Notifications
You must be signed in to change notification settings - Fork 184
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
first pass of gpu smoke test #281
Open
RobJY
wants to merge
6
commits into
rocker-org:master
Choose a base branch
from
RobJY:smoke-test-2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
fbc570b
first pass of gpu smoke test
RobJY 5e4a5ba
removed duplicated code
RobJY a623852
changed from backticks to parentheses
RobJY 2ef3245
removed repo from keras install
RobJY 10b6ea7
Merge branch 'master' into smoke-test-2
RobJY 96d5855
removed repo from keras install command
RobJY 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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# require one command line argument | ||
if [ "$#" -ne 1 ] | ||
then | ||
echo "Error: one argument for log location required (e.g. ./gpu-test.log)" | ||
echo "Usage: $0 log-location" | ||
exit 1 | ||
fi | ||
|
||
# set log location from command invokation | ||
LOG_LOC=$1 | ||
TEST_FAIL=false | ||
|
||
# driver | ||
PROC_DRIVER_FILE=/proc/driver/nvidia/version | ||
if [ ! -f "$PROC_DRIVER_FILE" ] | ||
then | ||
echo "$PROC_DRIVER_FILE doesn't exist" | tee -a $LOG_LOC | ||
echo "WARNING: CUDA driver may not be correctly installed." | tee -a $LOG_LOC | ||
TEST_FAIL=true | ||
else | ||
while read line; do | ||
IFS=' ' read -ra tmp_array <<< $line | ||
if [ ${tmp_array[0]} = "NVRM" ] && [ ${tmp_array[1]} = "version:" ] | ||
then | ||
VERSION_DRIVER=${tmp_array[7]} | ||
fi | ||
done < $PROC_DRIVER_FILE | ||
fi | ||
|
||
echo $VERSION_DRIVER | tee -a $LOG_LOC | ||
|
||
# toolkit | ||
if ! TOOLKIT_CHECK_OUTPUT=$(nvcc -V 2>&1); | ||
then | ||
echo "Failed to run 'nvcc -V' with error message: $TOOLKIT_CHECK_OUTPUT" | tee -a $LOG_LOC | ||
echo "WARNING: CUDA toolkit may not be correctly installed." | tee -a $LOG_LOC | ||
TEST_FAIL=true | ||
else | ||
# parse output to get version number | ||
while IFS= read -r line | ||
do | ||
IFS=' ' read -ra tmp_array <<< $line | ||
if [ "${tmp_array[3]}" = "release" ] | ||
then | ||
VERSION_TOOLKIT=${tmp_array[5]} | ||
fi | ||
done <<< $TOOLKIT_CHECK_OUTPUT | ||
fi | ||
|
||
echo $VERSION_TOOLKIT | tee -a $LOG_LOC | ||
|
||
# tensorflow | ||
if ! VERSION_TF_OUTPUT=$(python -c 'import tensorflow as tf; print(tf.__version__)' 2>&1); | ||
then | ||
echo "Error: trying to get tensorflow version: $TF_VERSION" | ||
else | ||
while IFS= read -r line | ||
do | ||
VERSION_TF=$line | ||
done <<< $VERSION_TF_OUTPUT | ||
fi | ||
|
||
echo $VERSION_TF | tee -a $LOG_LOC | ||
|
||
if [ "$TEST_FAIL" = true ] | ||
then | ||
echo "WARNING: at least one of the GPU functionality tests has failed." | tee -a $LOG_LOC | ||
echo "Please run rocker-versioned2/tests/gpu/test-gpu.sh script for more detailed information." | tee -a $LOG_LOC | ||
fi |
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
## Tensorflow: | ||
install.packages('keras', repos='http://cran.us.r-project.org') | ||
library(keras) | ||
mnist <- dataset_mnist() | ||
x_train <- mnist$train$x | ||
y_train <- mnist$train$y | ||
x_test <- mnist$test$x | ||
y_test <- mnist$test$y | ||
# reshape | ||
x_train <- array_reshape(x_train, c(nrow(x_train), 784)) | ||
x_test <- array_reshape(x_test, c(nrow(x_test), 784)) | ||
# rescale | ||
x_train <- x_train / 255 | ||
x_test <- x_test / 255 | ||
y_train <- to_categorical(y_train, 10) | ||
y_test <- to_categorical(y_test, 10) | ||
model <- keras_model_sequential() | ||
model %>% | ||
layer_dense(units = 256, activation = 'relu', input_shape = c(784)) %>% | ||
layer_dropout(rate = 0.4) %>% | ||
layer_dense(units = 128, activation = 'relu') %>% | ||
layer_dropout(rate = 0.3) %>% | ||
layer_dense(units = 10, activation = 'softmax') | ||
|
||
model %>% compile( | ||
loss = 'categorical_crossentropy', | ||
optimizer = optimizer_rmsprop(), | ||
metrics = c('accuracy') | ||
) | ||
history <- model %>% fit( | ||
x_train, y_train, | ||
epochs = 30, batch_size = 128, | ||
validation_split = 0.2 | ||
) | ||
model %>% evaluate(x_test, y_test) |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../../ml/nvblas.R |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
install.packages("callr") | ||
|
||
|
||
callr::r(function(){ | ||
system.time({ | ||
N <- 2^14 | ||
M <- matrix(rnorm(N*N), nrow=N, ncol=N) | ||
M %*% M | ||
}) | ||
}, env = c(LD_PRELOAD="libnvblas.so") | ||
) |
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.
Is there any reason to use a US CRAN mirror?
rocker-versioned2/scripts/install_R.sh
Line 9 in a382d7d
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.
@RobJY is this to trigger source installation?
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.
Should we need this line at all since tensorflow is installed in the containers by
scripts/install_tensorflow.sh
?When I attempt to run
exampls_tf.R
without it though I get the following error:Running
library(tensorflow)
in R gives a similar error message.Running
scripts/test-config-cuda.sh
reports the correct tensorflow version, but it's checking the version from Python withpython -c 'import tensorflow as tf; print(tf.__version__)'
.Do I need to add the path where tensorflow is installed by
scripts/install_tensorflow.sh
somewhere so R sees it?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.
What I wanted to point out is that the
repos
argument may simply be unnecessary.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.
Yes @eitsupi, you're right. It worked fine when I removed
repos
. Thanks! I've committed that change.It still seems like it shouldn't need to install that though. I tried adding the path
/opt/venv/reticulate
with the following code, but I got the same error:Is it fine to install
keras
here or does the fact that I need to install it indicate that there's an issue with the tensorflow install?