Here are some instructions to get a run going on a single node of fly by using leiningen (lein). This page should be enough to get you there if you know what you’re doing. For example, you should know how to do a single Clojush run on your own computer. This file explains how to perform single runs of Clojush using leiningen launches. (see also this for an outdated method using direct java calls).
First, install leiningen in your fly account if you have not already done so:
- cd ~/bin
- wget –no-check-certificate https://raw.github.com/technomancy/leiningen/stable/bin/lein
- chmod +x lein
- lein
and then if everything goes well lein will be set up.
For the rest, two methods are presented, using Github or not:
Using Github:
To use this method, you should be at least somewhat familiar with Git, including creating branches, checking out branches, and pushing to a remote (such as GitHub). Otherwise, you should use the “Not Using GitHub” method below.
- Create a Git branch for your code on your local machine. You can use master if you want to use an example as-is; otherwise, let’s suppose your branch is named cool-problem.
- (optional) Make sure your code is working on your local machine. Run it by using “lein run clojush.problems.demos.cool-problem” from within your Clojush directory (that’s assuming that your problem file is in src/problems/demos/cool_problem.clj). If you don’t get errors by the first generation, you should be good and can kill the run.
- Push your code to GitHub. Use your own fork. This will entail something like “git push origin cool-problem”.
- ssh to fly. You will need a fly account to do so. If you need one, talk to Josiah. (example: “ssh yourname@fly.hampshire.edu”)
- ssh to a compute node (example: “ssh compute-4-2”)
- Start a screen session with something like “screen -S cool”
- (NOTE: read this whole step, including substeps, before you get started) If you alread have a git-cloned version of Clojush on fly, cd to that. Otherwise, “git clone git@github.com:lspector/Clojush.git” will get clone Clojush from GitHub. Then, “cd clojush”.
- If you are using your fork of Clojush, replace “lspector” with “yourname”.
- If you haven’t set up your fly account’s ssh keys with GitHub, you’ll have to do that before this step, but it’s totally worth it. This will entail following the directions here, though DO NOT generate new keys. Instead. just do steps 1, 3, and 4, using the keys you should already have on fly. If you delete your current fly ssh keys, you will not be able to ssh to compute nodes.
- If you don’t want to mess with ssh keys as in substep 2, you could instead clone Clojush using the read-only link: git://github.com/lspector/Clojush.git . If you do this, you won’t be able to push changes and new commits back to GitHub, but you won’t have to worry about ssh keys.
- Now you should be in your Clojush directory. Get the branch you want to run by “git fetch origin” and then “git branch cool-problem origin/cool-problem” and then “git checkout cool-problem”.
- You should now have the code you want to run. You can look around to make sure this is the case.
- Run your code. You’ll want to do something like “lein run clojush.examples.cool-problem | tee out.txt”.
- Make sure the run has started smoothly.
- Detach your screen “C-a d”.
- Logout of fly. Later, ssh back into the node you are running on. Resume screen with “screen -r cool”. If things are finished, you can look at the new out.txt file and do whatever else you want. When you’re done with screen, make sure you close it with “C-d”.
Not using Github:
- (optional) Make sure your code is working on your local machine. Run it by using “lein run clojush.problems.demos.cool-problem” from within your Clojush directory (that’s assuming that your problem file is in src/problems/demos/cool_problem.clj). If you don’t get errors by the first generation, you should be good and can kill the run.
- Zip up your Clojush directory and scp it to your fly account.
- ssh to fly. You will need a fly account to do so. If you need one, talk to Josiah. (example: “ssh yourname@fly.hampshire.edu”)
- ssh to a compute node. (example: “ssh compute-4-2”)
- Unzip your Clojush directory.
- Start a screen session with something like “screen -S cool”
- cd into your Clojush directory.
- Run your code. You’ll want to do something like “lein run clojush.examples.cool-problem | tee out.txt”.
- Make sure the run has started smoothly.
- Detach your screen “C-a d”.
- Logout of fly. Later, ssh back into the node you are running on. Resume screen with “screen -r cool”. If things are finished, you can look at the new out.txt file and do whatever else you want. When you’re done with screen, make sure you close it with “C-d”.
Pingback: How to use single nodes of fly for Clojush runs | Computational Intelligence Laboratory
Pingback: How to do multiple runs of Clojush using tractor | Computational Intelligence Laboratory