- Install
cfncluster
locally. This process has only been tested with version 1.5.4. I prefer to use a conda environment for this.
$ conda create -n cfn python=3 pip
$ source activate cfn
$ pip install cfncluster==1.5.4
- Use the following configuration file in
~/.cfncluster/config
. I use the defaultbase_os
.
[aws]
aws_access_key_id = <ID>
aws_secret_access_key = <KEY>
aws_region_name = us-east-1
[cluster default]
key_name = <KEY NAME>
vpc_settings = test
master_instance_type = t2.small
compute_instance_type = c4.large
initial_queue_size = 0
maintain_initial_size = false
max_queue_size = <DESIRED MAX>
cluster_type = spot
spot_price = 0.10
post_install = s3://hogan-fragment-stats/install_conda_meep.sh
ec2_iam_role = CfnClusterEC2Role
extra_json = {"cfncluster": {"cfn_scheduler_slots": "1"}}
[vpc test]
vpc_id = vpc-<XXXXXXXX>
master_subnet_id = subnet-<XXXXXXXX>
[global]
cluster_template = default
update_check = true
sanity_check = true
[aliases]
ssh = ssh -i <PATH TO KEY> {CFN_USER}@{MASTER_IP} {ARGS}
The extra_json
tells the cluster to use only one core per EC2 compute instance. You can also
change the "1"
to "cores"
to associate a slot with each physical core. By default it will
associate a slot with each virtual cpu (hyperthread).
The install_conda_meep.sh
script is included in this gist. It installs the latest pymeep-parallel package into
a conda environment on all nodes at /opt/miniconda/envs/mp
. It then disables hyperthreading on all nodes.
- Create the cluster and ssh into the master node.
$ cfncluster create default
$ cfncluster ssh default
- Clone the Meep repo to the shared filesystem to run some tests
$ cd /shared
$ git clone https://github.com/stevengj/meep.git
- Submit a test job to make sure the cluster runs a process on each instance.
See
test.sh
below.
$ qsub test.sh
# Make sure 8 nodes are created (it can take a while)
$ qhost
Look for 8 different host names in the output file test.sh.o1
.
- Run some Meep scripts (see
run_meep_test.sh
below)
$ qsub run_meep_test.sh
# Use qhost to see instances and load.