Difference between revisions of "Run relax at Google Cloud Computing"

From relax wiki
Jump to navigation Jump to search
(Switch to the {{relax source}} and {{relax url}} templates for the code URLs.)
 
(102 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
The [https://en.wikipedia.org/wiki/Google_Cloud_Platform Google Cloud Platform] is a cloud computing platform that can be used for cheaply running relax on a cluster.
 +
 
== Background ==
 
== Background ==
 
This follows the same idea as from [[Run_relax_at_cloud.sagemath.com|Run relax at cloud.sagemath.com]]
 
This follows the same idea as from [[Run_relax_at_cloud.sagemath.com|Run relax at cloud.sagemath.com]]
  
Make a rapid deployment of relax on a computer cluster
+
Make a rapid deployment of relax on a google computer cluster, and calculate for 2 months with 8 CPU's, '''for free'''.
 
 
  
== pricing ==
+
== Pricing ==
 
For this example of '''Google Cloud Computing''', we wan't to have access to as many computer cores as possible
 
For this example of '''Google Cloud Computing''', we wan't to have access to as many computer cores as possible
  
 
* The pricing explained here: https://cloud.google.com/pricing/
 
* The pricing explained here: https://cloud.google.com/pricing/
 
* A pricing calculator is here: https://cloud.google.com/products/calculator/
 
* A pricing calculator is here: https://cloud.google.com/products/calculator/
 
'''For the price calculation of:'''
 
* '''1''' server
 
* using '''Free: Debian, CentOS, ...'''
 
* with a '''regular''' VM Class
 
* Instance type of (HIGH CPU) '''n1-highcpu-32    (vCPUs: 32, RAM: 28.80 GB)'''
 
* 0 '''SSD'''
 
* Datacenter location '''Europe'''
 
* Average days per month each server is running: '''1''' days, per month.
 
This '''1 day''' price was of November 2015, '''$32.26'''. Constantly running is $686.78 per month. <br>
 
  
 
At November 2015, google give free trial of '''300$'''. https://cloud.google.com/free-trial/
 
At November 2015, google give free trial of '''300$'''. https://cloud.google.com/free-trial/
Line 28: Line 19:
  
 
For this time, the most important limitation is 8 CPUs.
 
For this time, the most important limitation is 8 CPUs.
 +
 +
===8 CPU's===
 +
 
'''For the price calculation of:'''
 
'''For the price calculation of:'''
 
* '''1''' server
 
* '''1''' server
Line 34: Line 28:
 
* Instance type of (HIGH CPU) '''n1-highcpu-8    (vCPUs: 8, RAM: 7.20 GB)'''
 
* Instance type of (HIGH CPU) '''n1-highcpu-8    (vCPUs: 8, RAM: 7.20 GB)'''
 
* 0 '''SSD'''
 
* 0 '''SSD'''
* Datacenter location '''Europe'''
+
* Datacenter location '''United States'''
 
* Average days per month each server is running: '''1''' days, per month.  
 
* Average days per month each server is running: '''1''' days, per month.  
 
This '''1 day''' price was of November 2015, '''$8.06'''. Constantly running is $171.70 per month. <br>
 
This '''1 day''' price was of November 2015, '''$8.06'''. Constantly running is $171.70 per month. <br>
  
''''This essentially gives you 2 months of free computation with 8 CPU's. '''
+
'''This essentially gives you 2 months of free computation with 8 CPU's. '''
  
 
== Start free trial ==
 
== Start free trial ==
Line 51: Line 45:
 
* You should already have a project called '''My First Project'''.  
 
* You should already have a project called '''My First Project'''.  
 
* '''Create a new project''' in top right corner of the browser under the dropdown of '''My First Project'''.
 
* '''Create a new project''' in top right corner of the browser under the dropdown of '''My First Project'''.
* Call the new project '''relax''' with '''App Engine location''' at '''europe-west'''
+
* Call the new project name '''relax''', Project ID '''relax-1''', '''App Engine location''' at '''us-central'''. NOTE: App engine HAS TO BE located in united states, if datalab should be enabled later.
  
 
== Create a Virtual Machine instance ==
 
== Create a Virtual Machine instance ==
* Click then at '''Try Compute Engine''' or go to https://console.developers.google.com/compute
+
* Go to https://console.developers.google.com/home
* Click '''Create instance'''
+
* In the top right corner, there is a link to '''Activate Google Cloud Shell'''.
* '''Name:''' relax
+
* Clicking this should start a terminal in half the window.
* '''Zone:''' Don't change this. As of Nov 2015, it seems that if you change this, you cannot select more than 2 vCPU's
 
* '''Machine type:''' From the very bottom, create '''8 vCPUs'''. 32 cores need an upgrade to you account, [https://cloud.google.com/free-trial/#/faq and the free trial only allows for 8 vCPU's.]
 
* '''Boot disk:''' 10 GB of Ubuntu 14.04 LTS
 
* '''Zone:''' Now change this to: europe-west1-c
 
* Let the rest be default and click '''Create'''.
 
  
== Access Virtual Machine instance ==
+
Links
* Go to https://console.developers.google.com/compute
+
* [https://cloud.google.com/cloud-shell/docs/examples See examples here]
* In the line of '''relax''', click '''SSH'''
+
* [https://cloud.google.com/sdk/gcloud/reference/compute/instances/create instance creation examples here]
* This should open a '''browser terminal window'''
+
* [https://cloud.google.com/compute/docs/zones Google zones]
  
== Get relax and unpack ==
+
<source lang="bash">
 +
# List all compute instances in the project
 +
gcloud compute instances list
 +
gcloud compute zones list
 +
gcloud compute machine-types list | grep us-central1-f
 +
gcloud compute machine-types list | grep us-central1-f | sort -k3 -n
 +
gcloud compute images list
  
{{#tag:source|
+
# Create instance
v={{current version relax}}
+
gcloud compute instances create relax --zone us-central1-f --machine-type n1-highcpu-4 --image ubuntu-14-04 --boot-disk-size 10GB
 +
gcloud compute instances list
  
# Get relax
+
# Or
curl http://download.gna.org/relax/relax-$v.GNU-Linux.x86_64.tar.bz2 -o relax-$v.GNU-Linux.x86_64.tar.bz2
+
gcloud compute instances create relax --zone us-central1-f --machine-type n1-highcpu-4 --image rhel-6-v20160921 --boot-disk-size 10GB
  
# Make home bin
+
</source>
mkdir -p $HOME/bin
 
tar xvjf relax-{{current version relax}}.GNU-Linux.x86_64.tar.bz2
 
rm relax-{{current version relax}}.GNU-Linux.x86_64.tar.bz2
 
ln -s $HOME/relax-{{current version relax}}/relax $HOME/bin
 
  
# Add $HOME/bin to PATH
+
Then you can SSH into the instance
echo '' >> $HOME/.bashrc
+
<source lang="bash">
echo 'export PATH=$PATH:$HOME/bin' >> $HOME/.bashrc
+
PROJ=relax-1
source $HOME/.bashrc
+
ZONE=us-central1-f
|lang="bash"
+
PRID=instance-1
}}
+
GCC=gcc
 +
gcloud compute --project $PROJ ssh --zone $ZONE $PRID
  
Solve depencies. See also [[Installation_linux|Installation linux]]
+
gcloud compute --project "relax-1" ssh --zone "us-central1-f" "instance-1"
{{#tag:source|
+
</source>
sudo apt-get -y install python-numpy
 
|lang="bash"
 
}}
 
  
Then test relax
+
== Access Virtual Machine instance ==
{{#tag:source|
+
* Go to https://console.developers.google.com/compute
relax -i
+
* In the line of '''relax''', click '''SSH'''
|lang="bash"
+
* This should open a '''browser terminal window'''
}}
 
  
Then install other packages
+
== Install packages at server ==
Solve depencies. See also [[Installation_linux|Installation linux]]
 
{{#tag:source|
 
sudo apt-get -y install python-scipy python-matplotlib python-pip
 
sudo apt-get -y install openmpi-bin openmpi-doc libopenmpi-dev
 
sudo pip install mpi4py
 
sudo pip install epydoc
 
  
# Check installation
+
For '''rapid deployment''' use this command. This will install current version of relax and trunk.
relax -i
 
|lang="bash"
 
}}
 
  
== Inspect server ==
+
See the list of deploy scripts here
 +
* {{relax url|path=devel_scripts/deploy_scripts/}}
  
Install these very good server packages
+
Then download the script that matches the system.
Solve depencies. See alsp [[Installation_linux|Installation linux]]
+
{{#tag: source|
{{#tag:source|
+
# Select a version script
sudo apt-get -y install htop
+
# Redhat Version 6
|lang="bash"
+
VERS=deploy_google_computing_redhat_6_86_x64.sh
}}
+
VERS=deploy_google_computing_redhat_6_86_x64_upgrade_python.sh
 +
# Centos Version 6
 +
VERS=deploy_google_computing_centos_6_86_x64_upgrade_python.sh
 +
# Redhat Version 7
 +
VERS=deploy_google_computing_redhat_7_86_x64.sh
 +
# Ubuntu
 +
VERS=deploy_google_computing_ubuntu_14-04_86_x64.sh
  
Then check server
+
# Then set download URL
{{#tag:source|
+
URL={{relax url|path=devel_scripts/deploy_scripts/$VERS|view=raw}}
uptime
 
whoami
 
lscpu
 
htop -u `whoami`
 
|lang="bash"
 
}}
 
  
Then check mpirun
+
# Download and readl
{{#tag:source|
+
sudo yum -y install wget
mpirun --version
+
wget $URL $VERS
mpirun --report-bindings -np 4 echo "hello world"
+
mv $VERS* $VERS
mpirun --np 8 relax --multi='mpi4py'
+
cat $VERS
|lang="bash"
 
}}
 
  
==Install trunk of relax==
+
# Load functions
 +
source $VERS
  
=== Solve dependencies. ===
+
# Do installation
See alsp [[Installation_linux|Installation linux]]
+
installandcheck
{{#tag:source|
+
| lang="bash"
sudo apt-get -y install subversion scons grace
 
|lang="bash"
 
 
}}
 
}}
  
=== Checkout relax and build. ===
+
 
 +
'''Check installation of relax'''
 
{{#tag:source|
 
{{#tag:source|
svn co svn://svn.gna.org/svn/relax/trunk relax_trunk
+
mpirun --np 2 relax_trunk --multi='mpi4py'
 
+
relax_trunk --time -x
# Build
 
cd relax_trunk
 
scons
 
 
# Link to executable
 
cd $HOME
 
mkdir -p $HOME/bin
 
ln -s $HOME/relax_trunk/relax $HOME/bin/relax_trunk
 
 
# See relax info
 
relax_trunk -i
 
 
 
 
|lang="bash"
 
|lang="bash"
 
}}
 
}}
  
===install Minfx===
+
== Test openmpi ==
See [[Minfx]]
 
{{#tag:source|
 
v={{current version minfx}}
 
  
mkdir -p $HOME/Downloads
+
For BASH shell<br>
cd $HOME/Downloads
+
{{relax source|path=devel_scripts/openmpi_test_install_bash.sh|view=raw|text=See the script here}}
curl http://download.gna.org/minfx/minfx-$v.tar.gz -o minfx-$v.tar.gz
+
{{#tag: source|
tar -xzf minfx-$v.tar.gz
+
URL={{relax url|path=devel_scripts/openmpi_test_install_bash.sh|view=raw}}
cd minfx-$v
+
wget $URL
sudo pip install .
+
mv openmpi_test_install_bash.sh* openmpi_test_install_bash.sh
cd $HOME
 
  
# Test relax
+
# Source functions
relax_trunk -i
+
source openmpi_test_install_bash.sh
|lang="bash"
+
testopenmpi
 +
| lang="bash"
 
}}
 
}}
  
===install Bmrblib===
+
For TCSH shell<br>
See [[Bmrblib]]
+
{{relax source|path=devel_scripts/openmpi_test_install_tcsh.sh|view=raw|text=See the script here}}
{{#tag:source|
+
{{#tag: source|
v={{current version bmrblib}}
+
alias get 'set noglob; wget {{relax url|path=devel_scripts/openmpi_test_install_tcsh.sh|view=raw}}; mv openmpi_test_install_tcsh.sh* openmpi_test_install_tcsh.sh;unset noglob'
 +
get
  
mkdir -p $HOME/Downloads
+
# Source functions
cd $HOME/Downloads
+
source openmpi_test_install_tcsh.sh
curl http://download.gna.org/bmrblib/bmrblib-$v.tar.gz -o bmrblib-$v.tar.gz
+
| lang="bash"
tar -xzf bmrblib-$v.tar.gz
 
cd bmrblib-$v
 
sudo pip install .
 
cd $HOME
 
 
 
# Test relax
 
relax_trunk -i
 
|lang="bash"
 
 
}}
 
}}
  
==Check installation of relax==
 
{{#tag:source|
 
relax_trunk --time -x
 
|lang="bash"
 
}}
 
  
 
==Transfer files back and forth to the server==
 
==Transfer files back and forth to the server==
Se
+
See here
 
* https://cloud.google.com/compute/docs/tutorials/transfer-files
 
* https://cloud.google.com/compute/docs/tutorials/transfer-files
  
=== Install gcloud===
+
=== Install gcloud on your local computer===
 
See https://cloud.google.com/sdk/
 
See https://cloud.google.com/sdk/
  
 
On your own computer
 
On your own computer
<source lang="python">
+
<source lang="bash">
 
cd $HOME/Downloads
 
cd $HOME/Downloads
 
curl https://sdk.cloud.google.com | bash
 
curl https://sdk.cloud.google.com | bash
Line 226: Line 178:
  
 
This will start a browser to authenticate you. When it ask for a ID, just write "test" and say no to cloning.
 
This will start a browser to authenticate you. When it ask for a ID, just write "test" and say no to cloning.
 
Then go to:
 
* https://console.developers.google.com/compute
 
* In the line of relax, click SSH, and drop down to: '''View gcloud command'''.
 
 
It could look like this. Try this in your own terminal. This should make some SSH keys and bring you to the server
 
<source lang="text">
 
gcloud compute --project "relax-1143" ssh --zone "europe-west1-c" "relax"
 
</source>
 
 
This should bring you to the google server.
 
<source lang="bash">
 
lscpu
 
cat $HOME/.ssh/authorized_keys
 
exit
 
 
# At your own computer
 
ls -l $HOME/.ssh/google*
 
cat $HOME/.ssh/config
 
ssh-add -l
 
ssh-add $HOME/.ssh/google_compute_engine
 
ssh-add -l
 
</source>
 
 
=== Copy files ===
 
See: https://cloud.google.com/sdk/gcloud/reference/compute/copy-files
 
 
The ssh command was
 
<source lang="bash">
 
gcloud compute --project "relax-1143" ssh --zone "europe-west1-c" "relax"
 
</source>
 
 
We make a test file and copy it
 
<source lang="bash">
 
touch test.txt
 
gcloud compute --project "relax-1143" copy-files test.txt relax:~ --zone "europe-west1-c"
 
 
# Try a directory
 
mkdir testdir
 
cp test.txt testdir
 
gcloud compute --project "relax-1143" copy-files testdir relax:~ --zone "europe-west1-c"
 
 
# Back again
 
cd testdir
 
gcloud compute --project "relax-1143" copy-files relax:~/testdir . --zone "europe-west1-c"
 
</source>
 
  
 
=== ssh-config with gcloud ===
 
=== ssh-config with gcloud ===
Line 279: Line 185:
  
 
<source lang="bash">
 
<source lang="bash">
gcloud compute --project "relax-1143" config-ssh
+
PROJ=relax-1
 +
ZONE=us-central1-f
 +
PRID=relax
 +
GCC=gcc
 +
gcloud compute --project $PROJ config-ssh
 
cat $HOME/.ssh/config
 
cat $HOME/.ssh/config
 
# ssh in
 
ssh relax.europe-west1-c.relax-1143
 
exit
 
  
 
# Use sed to change value of your local computes ssh config file
 
# Use sed to change value of your local computes ssh config file
grep 'relax.europe-west1-c.relax-1143' $HOME/.ssh/config
+
sed -i.bak "s/$PRID.$ZONE.$PROJ/$GCC/g" $HOME/.ssh/config
sed 's/relax.europe-west1-c.relax-1143/gcc_relax/g' $HOME/.ssh/config
 
sed -i.bak 's/relax.europe-west1-c.relax-1143/gcc_relax/g' $HOME/.ssh/config
 
 
ls -l $HOME/.ssh/config*
 
ls -l $HOME/.ssh/config*
grep 'gcc_relax' $HOME/.ssh/config
+
grep "$GCC" $HOME/.ssh/config
ssh gcc_relax
+
ssh $GCC
 +
exit
 
</source>
 
</source>
  
Line 299: Line 204:
 
{{#tag:source|
 
{{#tag:source|
 
#First fast check
 
#First fast check
 +
cd $HOME/Downloads
 
touch test2.txt
 
touch test2.txt
scp test2.txt gcc_relax:
+
scp test2.txt $GCC:
ssh gcc_relax
+
ssh $GCC
 
ls
 
ls
 +
rm test2.txt
 
exit
 
exit
 +
rm test2.txt
  
 
# Or use rsync
 
# Or use rsync
mkdir dirtest
+
mkdir deletethisdir
rsync --progress -avzhe ssh ./dirtest gcc_relax:
+
rsync --progress -avzhe ssh ./deletethisdir $GCC:
ssh gcc_relax
+
ssh $GCC
 
ls
 
ls
rmdir dirtest
+
rmdir deletethisdir
 
exit
 
exit
 +
rmdir deletethisdir
 +
|lang="bash"
 +
}}
 +
 +
== Use relax on a test dataset from a tutorial ==
 +
This follows some example data from the tutorial here [[Tutorial_for_sorting_data_stored_as_numpy_to_on-resonance_R1rho_analysis|Tutorial for sorting data stored as numpy to on resonance R1rho_analysis]]
 +
 +
{{relax source|path=test_suite/shared_data/dispersion/Paul_Schanda_2015_Nov|text=Overview of directory}}
 +
 +
Copy data to local dir
 +
{{#tag:source|
 +
cd $HOME
 +
cp -r $HOME/relax_trunk/test_suite/shared_data/dispersion/Paul_Schanda_2015_Nov .
 +
cd Paul_Schanda_2015_Nov
 +
|lang="bash"
 +
}}
 +
 +
 +
{{relax source|path=test_suite/shared_data/dispersion/Paul_Schanda_2015_Nov/1_tutorial_prepare_data.py|text=Prepare data}}
 +
{{#tag:source|
 +
cat 1_tutorial_prepare_data.py
 +
python 1_tutorial_prepare_data.py
 +
ls -latr
 +
|lang="bash"
 +
}}
 +
 +
{{relax source|path=test_suite/shared_data/dispersion/Paul_Schanda_2015_Nov/2_tutorial_load_data.py|text=Run analysis}}
 +
{{#tag:source|
 +
cat 2_tutorial_load_data.py
 +
mpirun --np 2 relax_trunk --multi='mpi4py' 2_tutorial_load_data.py
 +
ls -latr
 +
|lang="bash"
 +
}}
 +
 +
{{relax source|path=test_suite/shared_data/dispersion/Paul_Schanda_2015_Nov/3_tutorial_clustered.py|text=Run clustered analysis}}
 +
 +
{{#tag:source|
 +
cat 3_tutorial_clustered.py
 +
mpirun --np 2 relax_trunk --multi='mpi4py' 3_tutorial_clustered.py
 +
ls -latr
 +
|lang="bash"
 +
}}
 +
 +
See results
 +
{{#tag:source|
 +
cd results_cluster/final
 +
ls -latr
 +
cat phi_ex.out
 +
cat kex.out
 
|lang="bash"
 
|lang="bash"
 
}}
 
}}
  
 
==STOP the google instance after test to stop the billing of computation==
 
==STOP the google instance after test to stop the billing of computation==
 +
See: https://cloud.google.com/compute/docs/instances/stopping-or-deleting-an-instance
  
 
===By browser===
 
===By browser===
Line 324: Line 282:
 
===By terminal===
 
===By terminal===
 
<source lang="bash">
 
<source lang="bash">
 +
PROJ=relax-1
 +
ZONE=us-central1-f
 +
PRID=relax
 +
GCC=gcc
 +
 
# Get at list of projects
 
# Get at list of projects
gcloud compute --project "relax-1143" instances list
+
gcloud compute --project $PROJ instances list
  
 
# Start it, it takes 30 seconds.
 
# Start it, it takes 30 seconds.
gcloud compute --project "relax-1143" instances start --zone "europe-west1-c" "relax"
+
gcloud compute --project $PROJ instances start --zone $ZONE $PRID
ssh gcc_relax
+
ssh $GCC
 
exit
 
exit
  
 
# Stop it through terminal
 
# Stop it through terminal
gcloud compute --project "relax-1143" instances stop --zone "europe-west1-c" "relax"
+
gcloud compute --project $PROJ instances stop --zone $ZONE $PRID
 
# This should now not work
 
# This should now not work
ssh gcc_relax
+
ssh $GCC
 
</source>
 
</source>
 +
 +
==Upgrade account==
 +
To use 32 CPU's you need to upgrade your account
 +
 +
See
 +
* https://cloud.google.com/free-trial/docs/upgrade-paid-account
 +
* https://console.developers.google.com/compute/quotas
 +
* https://cloud.google.com/free-trial/docs/free-trial-quotas
 +
 +
==Deploy google datalab to your server==
 +
{{warning|This does not work}}
 +
 +
Read more here: http://techcrunch.com/2015/10/13/google-launches-cloud-datalab-an-interactive-tool-for-exploring-and-visualizing-data
 +
 +
Note: '''Cloud Datalab uses AppEngine and Managed VMs beta, which is available in the US region only.'''<br>
 +
'''You cannot change the location after the project has been created.'''<br>
 +
See Location at: https://appengine.google.com/
 +
 +
Stop your server:
 +
<source lang="bash">
 +
gcloud compute --project $PROJ instances stop --zone $ZONE $PRID
 +
</source>
 +
 +
Cloud Datalab is deployed as an Google App Engine application module in a Google Developers Console project. <br>
 +
[https://console.developers.google.com/flows/enableapi?apiid=compute_component&redirect=https://console.developers.google.com/&_ga=1.74861778.1584957856.1448496848 Click here to → Enable the Google Compute Engine API.]
 +
 +
Visit:
 +
* https://cloud.google.com/datalab
 +
* https://cloud.google.com/datalab/getting-started
 +
 +
Do the following
 +
* Launch datalab
 +
* Sign in
 +
* Deploy to your project.
  
 
== See also ==
 
== See also ==
 
[[Category:Installation]]
 
[[Category:Installation]]

Latest revision as of 12:47, 27 October 2017

The Google Cloud Platform is a cloud computing platform that can be used for cheaply running relax on a cluster.

Background

This follows the same idea as from Run relax at cloud.sagemath.com

Make a rapid deployment of relax on a google computer cluster, and calculate for 2 months with 8 CPU's, for free.

Pricing

For this example of Google Cloud Computing, we wan't to have access to as many computer cores as possible

At November 2015, google give free trial of 300$. https://cloud.google.com/free-trial/

Note, there are some limitations:

For this time, the most important limitation is 8 CPUs.

8 CPU's

For the price calculation of:

  • 1 server
  • using Free: Debian, CentOS, ...
  • with a regular VM Class
  • Instance type of (HIGH CPU) n1-highcpu-8 (vCPUs: 8, RAM: 7.20 GB)
  • 0 SSD
  • Datacenter location United States
  • Average days per month each server is running: 1 days, per month.

This 1 day price was of November 2015, $8.06. Constantly running is $171.70 per month.

This essentially gives you 2 months of free computation with 8 CPU's.

Start free trial

Please first see this video:

Go to: https://cloud.google.com/free-trial/ and click Start your free trial.

You need to sign up with a credit card. To prevent mis-abuse from robots and hackers.

Then go to: https://console.developers.google.com

  • You should already have a project called My First Project.
  • Create a new project in top right corner of the browser under the dropdown of My First Project.
  • Call the new project name relax, Project ID relax-1, App Engine location at us-central. NOTE: App engine HAS TO BE located in united states, if datalab should be enabled later.

Create a Virtual Machine instance

Links

# List all compute instances in the project
gcloud compute instances list
gcloud compute zones list
gcloud compute machine-types list | grep us-central1-f
gcloud compute machine-types list | grep us-central1-f | sort -k3 -n
gcloud compute images list

# Create instance
gcloud compute instances create relax --zone us-central1-f --machine-type n1-highcpu-4 --image ubuntu-14-04 --boot-disk-size 10GB 
gcloud compute instances list

# Or
gcloud compute instances create relax --zone us-central1-f --machine-type n1-highcpu-4 --image rhel-6-v20160921 --boot-disk-size 10GB

Then you can SSH into the instance

PROJ=relax-1
ZONE=us-central1-f
PRID=instance-1
GCC=gcc
gcloud compute --project $PROJ ssh --zone $ZONE $PRID

gcloud compute --project "relax-1" ssh --zone "us-central1-f" "instance-1"

Access Virtual Machine instance

Install packages at server

For rapid deployment use this command. This will install current version of relax and trunk.

See the list of deploy scripts here

Then download the script that matches the system.

# Select a version script
# Redhat Version 6
VERS=deploy_google_computing_redhat_6_86_x64.sh
VERS=deploy_google_computing_redhat_6_86_x64_upgrade_python.sh
# Centos Version 6
VERS=deploy_google_computing_centos_6_86_x64_upgrade_python.sh
# Redhat Version 7
VERS=deploy_google_computing_redhat_7_86_x64.sh
# Ubuntu
VERS=deploy_google_computing_ubuntu_14-04_86_x64.sh

# Then set download URL
URL=https://sourceforge.net/p/nmr-relax/code/ci/master/tree/devel_scripts/deploy_scripts/$VERS?format=raw

# Download and readl
sudo yum -y install wget
wget $URL $VERS
mv $VERS* $VERS
cat $VERS

# Load functions
source $VERS

# Do installation
installandcheck


Check installation of relax

mpirun --np 2 relax_trunk --multi='mpi4py'
relax_trunk --time -x

Test openmpi

For BASH shell
See the script here

URL=https://sourceforge.net/p/nmr-relax/code/ci/master/tree/devel_scripts/openmpi_test_install_bash.sh?format=raw
wget $URL
mv openmpi_test_install_bash.sh* openmpi_test_install_bash.sh

# Source functions
source openmpi_test_install_bash.sh
testopenmpi

For TCSH shell
See the script here

alias get 'set noglob; wget https://sourceforge.net/p/nmr-relax/code/ci/master/tree/devel_scripts/openmpi_test_install_tcsh.sh?format=raw; mv openmpi_test_install_tcsh.sh* openmpi_test_install_tcsh.sh;unset noglob'
get

# Source functions
source openmpi_test_install_tcsh.sh


Transfer files back and forth to the server

See here

Install gcloud on your local computer

See https://cloud.google.com/sdk/

On your own computer

cd $HOME/Downloads
curl https://sdk.cloud.google.com | bash
source $HOME/.bash_profile
gcloud init

This will start a browser to authenticate you. When it ask for a ID, just write "test" and say no to cloning.

ssh-config with gcloud

See https://cloud.google.com/sdk/gcloud/reference/compute/config-ssh

gcloud compute config-ssh makes SSHing to virtual machine instances easier by adding an alias for each instance to the user SSH configuration (~/.ssh/config) file.

PROJ=relax-1
ZONE=us-central1-f
PRID=relax
GCC=gcc
gcloud compute --project $PROJ config-ssh
cat $HOME/.ssh/config

# Use sed to change value of your local computes ssh config file
sed -i.bak "s/$PRID.$ZONE.$PROJ/$GCC/g" $HOME/.ssh/config
ls -l $HOME/.ssh/config*
grep "$GCC" $HOME/.ssh/config
ssh $GCC
exit

Use scp and rsync when gcloud has been ssh-config configured

#First fast check
cd $HOME/Downloads
touch test2.txt
scp test2.txt $GCC:
ssh $GCC
ls
rm test2.txt
exit
rm test2.txt

# Or use rsync
mkdir deletethisdir
rsync --progress -avzhe ssh ./deletethisdir $GCC:
ssh $GCC
ls
rmdir deletethisdir
exit
rmdir deletethisdir

Use relax on a test dataset from a tutorial

This follows some example data from the tutorial here Tutorial for sorting data stored as numpy to on resonance R1rho_analysis

Overview of directory

Copy data to local dir

cd $HOME
cp -r $HOME/relax_trunk/test_suite/shared_data/dispersion/Paul_Schanda_2015_Nov .
cd Paul_Schanda_2015_Nov


Prepare data

cat 1_tutorial_prepare_data.py 
python 1_tutorial_prepare_data.py
ls -latr

Run analysis

cat 2_tutorial_load_data.py
mpirun --np 2 relax_trunk --multi='mpi4py' 2_tutorial_load_data.py
ls -latr

Run clustered analysis

cat 3_tutorial_clustered.py 
mpirun --np 2 relax_trunk --multi='mpi4py' 3_tutorial_clustered.py 
ls -latr

See results

cd results_cluster/final
ls -latr
cat phi_ex.out
cat kex.out

STOP the google instance after test to stop the billing of computation

See: https://cloud.google.com/compute/docs/instances/stopping-or-deleting-an-instance

By browser

Go to:

By terminal

PROJ=relax-1
ZONE=us-central1-f
PRID=relax
GCC=gcc

# Get at list of projects
gcloud compute --project $PROJ instances list

# Start it, it takes 30 seconds.
gcloud compute --project $PROJ instances start --zone $ZONE $PRID
ssh $GCC
exit

# Stop it through terminal
gcloud compute --project $PROJ instances stop --zone $ZONE $PRID
# This should now not work
ssh $GCC

Upgrade account

To use 32 CPU's you need to upgrade your account

See

Deploy google datalab to your server

Warning  This does not work

Read more here: http://techcrunch.com/2015/10/13/google-launches-cloud-datalab-an-interactive-tool-for-exploring-and-visualizing-data

Note: Cloud Datalab uses AppEngine and Managed VMs beta, which is available in the US region only.
You cannot change the location after the project has been created.
See Location at: https://appengine.google.com/

Stop your server:

gcloud compute --project $PROJ instances stop --zone $ZONE $PRID

Cloud Datalab is deployed as an Google App Engine application module in a Google Developers Console project.
Click here to → Enable the Google Compute Engine API.

Visit:

Do the following

  • Launch datalab
  • Sign in
  • Deploy to your project.

See also