Open main menu

Changes

Run relax at Google Cloud Computing

229 bytes added, 12:47, 27 October 2017
Switch to the {{relax source}} and {{relax url}} templates for the code URLs.
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 ==
This follows the same idea as from [[Run_relax_at_cloud.sagemath.com|Run relax at cloud.sagemath.com]]
== Create a Virtual Machine instance ==
* Click then at '''Try Compute Engine''' or go Go to https://console.developers.google.com/compute* Click '''Create instance'''* '''Name:''' relax* '''Zone:''' Don't change this. As of Nov 2015, it seems that if you change this, you cannot select more than 2 vCPU'shome* '''Machine type:''' From In the very bottomtop right corner, create '''8 vCPUs'''. 32 cores need an upgrade there is a link to you account, [https://cloud.google.com/free-trial/#/faq and the free trial only allows for 8 vCPU's.]* '''Boot disk:Activate Google Cloud Shell''' 10 GB of Ubuntu 14.04 LTS* '''Zone:''' [https://cloud.google.com/compute/docs/zones Now change Clicking this to:] us-central1-f* Let should start a terminal in half the rest be default and click '''Create'''window.
== Access Virtual Machine instance ==Links* Go to [https://consolecloud.developersgoogle.com/cloud-shell/docs/examples See examples here]* [https://cloud.google.com/sdk/gcloud/reference/compute/instances/create instance creation examples here]* In the line of '''relax''', click '''SSH''' * This should open a '''browser terminal window'''[https://cloud.google.com/compute/docs/zones Google zones]
<source lang== Install packages at server =="bash"># List all compute instances in the projectgcloud compute instances listgcloud compute zones listgcloud compute machine-types list | grep us-central1-fgcloud compute machine-types list | grep us-central1-f | sort -k3 -ngcloud compute images list
For '''rapid deployment''' use this command. This will install current version of # Create instancegcloud compute instances create relax and trunk.--zone us-central1-f --machine-type n1-highcpu-4 --image ubuntu-14-04 --boot-disk-size 10GB {{#tag:source|gcloud compute instances list
|lang="bash"# Or}}gcloud compute instances create relax --zone us-central1-f --machine-type n1-highcpu-4 --image rhel-6-v20160921 --boot-disk-size 10GB
=== Inspect server ===</source>
Install these very good server packagesThen you can SSH into the instanceSolve depencies. See alsp [[Installation_linux|Installation linux]]<source lang="bash">PROJ=relax-1{{#tag:source|ZONE=us-central1-fsudo aptPRID=instance-get 1GCC=gccgcloud compute -y install openmpi-bin openmpiproject $PROJ ssh -doc libopenmpi-devzone $ZONE $PRIDsudo aptgcloud compute --project "relax-1" ssh --zone "us-get central1-y install htop|lang=f" "bashinstance-1"}}</source>
Then check server== Access Virtual Machine instance =={{#tag* Go to https:source|//console.developers.google.com/computeuptimewhoamilscpuhtop -u `whoami`|lang="bash"* In the line of '''relax''', click '''SSH''' }}* This should open a '''browser terminal window'''
Then check mpirun{{#tag:source|mpirun --versionmpirun --report-bindings -np 4 echo "hello world"|lang="bash"}}= Install packages at server ==
=== Get For '''rapid deployment''' use this command. This will install current version of relax and unpack ===trunk.
See the list of deploy scripts here* {{#tag:sourcerelax url|vpath={{current version relaxdevel_scripts/deploy_scripts/}}
Then download the script that matches the system.{{#tag: source|# Select a version script# Get relaxRedhat Version 6curl http://downloadVERS=deploy_google_computing_redhat_6_86_x64.gnashVERS=deploy_google_computing_redhat_6_86_x64_upgrade_python.org/relax/relax-$vsh# Centos Version 6VERS=deploy_google_computing_centos_6_86_x64_upgrade_python.GNU-Linuxsh# Redhat Version 7VERS=deploy_google_computing_redhat_7_86_x64.x86_64.tar.bz2 -o relaxsh# UbuntuVERS=deploy_google_computing_ubuntu_14-$v.GNU-Linux.x86_64.tar04_86_x64.bz2sh
# Make home binThen set download URLmkdir -p $HOME/bintar xvjf relax-URL={{current version relax}}.GNU-Linux.x86_64.tar.bz2rm relax-{{current version relax}}.GNU-Linux.x86_64.tar.bz2ln -s url|path=devel_scripts/deploy_scripts/$HOME/relax-{{current version relaxVERS|view=raw}}/relax $HOME/bin
# Add Download and readlsudo yum -y install wgetwget $HOME/bin to PATHecho '' >> URL $HOME/.bashrcVERSecho 'export PATH=$PATH:mv $HOME/bin' >> VERS* $HOME/.bashrcVERSsource cat $HOME/.bashrc|lang="bash"}}VERS
Solve depencies. See also [[Installation_linux|Installation linux]]# Load functions{{#tag:source|sudo apt-get -y install python-numpysudo apt-get -y install python-scipy python-matplotlib python-pipsudo pip install mpi4pysudo pip install epydoc$VERS
# Check Do installationrelax -iinstallandcheck|lang="bash"
}}
===Install trunk of relax===
See alsp [[Installation_linux|Installation linux]]'''Check installation of relax'''
{{#tag:source|
sudo aptmpirun -get -y install subversion scons gracenp 2 relax_trunk --multi='mpi4py'relax_trunk --time -x
|lang="bash"
}}
Checkout relax and build{{#tag:source|svn co svn://svn.gna.org/svn/relax/trunk relax_trunk # Buildcd relax_trunkscons # Link to executablecd $HOMEmkdir -p $HOME/binln -s $HOME/relax_trunk/relax $HOME/bin/relax_trunk # See relax inforelax_trunk -i|lang="bash"}}= Test openmpi ==
'''install Minfx'''For BASH shell<br>{{relax source|path=devel_scripts/openmpi_test_install_bash.sh|view=raw|text=See [[Minfx]]the script here}}{{#tag:source|vURL={{current version minfxrelax url|path=devel_scripts/openmpi_test_install_bash.sh|view=raw}}wget $URLmv openmpi_test_install_bash.sh* openmpi_test_install_bash.sh
mkdir -p $HOME/Downloads# Source functionscd $HOME/Downloadscurl http://downloadsource openmpi_test_install_bash.gna.org/minfx/minfx-$v.tar.gz -o minfx-$v.tar.gztar -xzf minfx-$v.tar.gzcd minfx-$vsudo pip install .cd $HOME # Test relaxshrelax_trunk -itestopenmpi|lang="bash"
}}
'''install Bmrblib'''For TCSH shell<br>{{relax source|path=devel_scripts/openmpi_test_install_tcsh.sh|view=raw|text=See [[Bmrblib]]the script here}}{{#tag:source|v=alias get 'set noglob; wget {{current version bmrblibrelax url|path=devel_scripts/openmpi_test_install_tcsh.sh|view=raw}} mkdir -p $HOME/Downloadscd $HOME/Downloadscurl http://download; mv openmpi_test_install_tcsh.gna.org/bmrblib/bmrblib-$v.tar.gz -o bmrblib-$v.tar.gztar -xzf bmrblib-$v.tar.gzcd bmrblib-$vsudo pip install sh* openmpi_test_install_tcsh.sh;unset noglob'cd $HOMEget
# Test relaxSource functionsrelax_trunk -isource openmpi_test_install_tcsh.sh|lang="bash"
}}
'''Check installation of relax'''
{{#tag:source|
mpirun --np 8 relax_trunk --multi='mpi4py'
relax_trunk --time -x
|lang="bash"
}}
==Transfer files back and forth to the server==
SeSee here
* https://cloud.google.com/compute/docs/tutorials/transfer-files
=== Install gcloudon your local computer===
See https://cloud.google.com/sdk/
On your own computer
<source lang="pythonbash">
cd $HOME/Downloads
curl https://sdk.cloud.google.com | bash
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:=== ssh-config with gcloud ===* See https://console.developerscloud.google.com/sdk/gcloud/reference/compute* In the line of relax, click SSH, and drop down to: '''View gcloud command'''./config-ssh
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 config--project "relax-1" ssh --zone "us-central1-f" "relax"</source> This should bring you makes SSHing to virtual machine instances easier by adding an alias for each instance to the google server.<source lang="bash">lscpucat $HOME/.ssh/authorized_keys exit # At your own computerls -l $HOME/.ssh/google*cat $HOMEuser SSH configuration (~/.ssh/configssh-add -lssh-add $HOME/.ssh/google_compute_enginessh-add -l</source> === Copy files ===See: https://cloud.google) file.com/sdk/gcloud/reference/compute/copy-files
The ssh command was
<source lang="bash">
bash
PROJ=relax-1
ZONE=us-central1-f
PRID=relax
GCC=gcc
gcloud compute --project $PROJ ssh --zone $ZONE $PRID
</source>
 
We make a test file and copy it
<source lang="bash">
touch test.txt
gcloud compute --project $PROJ copy-files test.txt $PRID:~ --zone $ZONE
 
# Try a directory
mkdir testdir
cp test.txt testdir
gcloud compute --project $PROJ copy-files testdir $PRID:~ --zone $ZONE
 
# Back again
cd testdir
gcloud compute --project $PROJ copy-files $PRID:~/testdir . --zone $ZONE
</source>
 
=== 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.
 
<source lang="bash">
gcloud compute --project $PROJ config-ssh
cat $HOME/.ssh/config
 
# ssh in
ssh $PRID.$ZONE.$PROJ
exit
# Use sed to change value of your local computes ssh config file
grep "$PRID.$ZONE.$PROJ" $HOME/.ssh/config
sed "s/$PRID.$ZONE.$PROJ/$GCC/g" $HOME/.ssh/config
sed -i.bak "s/$PRID.$ZONE.$PROJ/$GCC/g" $HOME/.ssh/config
ls -l $HOME/.ssh/config*
{{#tag:source|
#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 dirtestdeletethisdirrsync --progress -avzhe ssh ./dirtest deletethisdir $GCC:
ssh $GCC
ls
rmdir dirtestdeletethisdir
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"
}}
===By terminal===
<source lang="bash">
PROJ=relax-1
ZONE=us-central1-f
PRID=relax
GCC=gcc
 
# Get at list of projects
gcloud compute --project $PROJ instances list
==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
See Location at: https://appengine.google.com/
Start Stop your server:
<source lang="bash">
gcloud compute --project $PROJ instances start stop --zone $ZONE $PRIDssh $GCC
</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:
* Launch datalab
* Sign in
* Deploy to your project. This takes '''10 min.'''
== See also ==
[[Category:Installation]]
Trusted, Bureaucrats
4,223

edits