Open main menu

Changes

User:Troels Emtekær Linnet

7,820 bytes removed, 15:59, 28 November 2015
yCAR_ppm = 118.078
</source>
 
= Google Cloud Computing =
This follows the same idea as from [[Run_relax_at_cloud.sagemath.com|Run relax at cloud.sagemath.com]]
 
== pricing ==
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/
* 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.
The '''monthly''' price was of November 2015, '''$32.26'''.
 
At November 2015, google give free trial of '''300$'''. https://cloud.google.com/free-trial/
 
Note, there are some limitations: https://cloud.google.com/free-trial/#/faq
 
== Start free trial ==
Please first see this video:
* https://cloud.google.com/compute/docs/linux-quickstart or https://www.youtube.com/watch?v=BnEhYaUY4sA
 
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 '''relax''' with '''App Engine location''' at '''europe-west'''
 
== Create a Virtual Machine instance ==
* Click then at '''Try Compute Engine''' or 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'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 ==
* Go to https://console.developers.google.com/compute
* In the line of '''relax''', click '''SSH'''
* This should open a '''browser terminal window'''
 
== Get relax and unpack ==
 
{{#tag:source|
v={{current version relax}}
 
# Get relax
curl http://download.gna.org/relax/relax-$v.GNU-Linux.x86_64.tar.bz2 -o relax-$v.GNU-Linux.x86_64.tar.bz2
 
# Make home bin
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
echo '' >> $HOME/.bashrc
echo 'export PATH=$PATH:$HOME/bin' >> $HOME/.bashrc
source $HOME/.bashrc
|lang="bash"
}}
 
Solve depencies. See also [[Installation_linux|Installation linux]]
{{#tag:source|
sudo apt-get -y install python-numpy
|lang="bash"
}}
 
Then test relax
{{#tag:source|
relax -i
|lang="bash"
}}
 
Then install other packages
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
relax -i
|lang="bash"
}}
 
== Inspect server ==
 
Install these very good server packages
Solve depencies. See alsp [[Installation_linux|Installation linux]]
{{#tag:source|
sudo apt-get -y install htop
|lang="bash"
}}
 
Then check server
{{#tag:source|
uptime
whoami
lscpu
htop -u `whoami`
|lang="bash"
}}
 
Then check mpirun
{{#tag:source|
mpirun --version
mpirun --report-bindings -np 4 echo "hello world"
mpirun --np 8 relax --multi='mpi4py'
|lang="bash"
}}
 
==Install trunk of relax==
 
=== Solve dependencies. ===
See alsp [[Installation_linux|Installation linux]]
{{#tag:source|
sudo apt-get -y install subversion scons grace
|lang="bash"
}}
 
=== Checkout relax and build. ===
{{#tag:source|
svn co svn://svn.gna.org/svn/relax/trunk relax_trunk
 
# 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"
}}
 
===install Minfx===
See [[Minfx]]
{{#tag:source|
v={{current version minfx}}
 
mkdir -p $HOME/Downloads
cd $HOME/Downloads
curl http://download.gna.org/minfx/minfx-$v.tar.gz -o minfx-$v.tar.gz
tar -xzf minfx-$v.tar.gz
cd minfx-$v
sudo pip install .
cd $HOME
 
# Test relax
relax_trunk -i
|lang="bash"
}}
 
===install Bmrblib===
See [[Bmrblib]]
{{#tag:source|
v={{current version bmrblib}}
 
mkdir -p $HOME/Downloads
cd $HOME/Downloads
curl http://download.gna.org/bmrblib/bmrblib-$v.tar.gz -o bmrblib-$v.tar.gz
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==
Se
* https://cloud.google.com/compute/docs/tutorials/transfer-files
 
=== Install gcloud===
See https://cloud.google.com/sdk/
 
On your own computer
<source lang="python">
cd $HOME/Downloads
curl https://sdk.cloud.google.com | bash
source $HOME/.bash_profile
gcloud init
</source>
 
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 ===
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 "relax-1143" config-ssh
cat $HOME/.ssh/config
 
# ssh in
ssh relax.europe-west1-c.relax-1143
 
# Use sed to change value
grep 'relax.europe-west1-c.relax-1143' $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*
grep 'gcc_relax' $HOME/.ssh/config
ssh gcc_relax
</source>
 
=== Use scp and rsync ===
 
{{#tag:source|
#First fast check
touch test2.txt
scp test2.txt gcc_relax:
ssh gcc_relax
ls
exit
 
# Or use rsync
mkdir dirtest
rsync --progress -avzhe ssh ./dirtest gcc_relax:
ssh gcc_relax
ls
rmdir dirtest
exit
|lang="bash"
}}