Skip to content

Commit

Permalink
moved hello.c to example directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Pete Skomoroch committed May 29, 2009
1 parent 7e9378c commit 7869bfe
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 45 deletions.
51 changes: 6 additions & 45 deletions lib/bootscripts/ubuntu_installs.sh
Expand Up @@ -148,7 +148,6 @@ else
done
fi


### Set up hosts file on each node. hostsfile will only be ready after all child nodes start booting.
chmod go-w /mnt/elasticwulf
curl -u $admin_user:$admin_password -k ${rest_url}jobs/${job_id}/hosts >> /etc/hosts
Expand All @@ -174,10 +173,12 @@ then
done
echo "All workers have mounted NFS home directory, cluster is ready for MPI jobs"

# get total number of cpus in cluster from REST action
# Quick test of local openmpi
su - elasticwulf -c "mpicc /home/elasticwulf/elasticwulf-service/lib/examples/hello.c -o /home/elasticwulf/hello"
su - elasticwulf -c "mpirun -np 2 /home/elasticwulf/hello > local_mpi_smoketest.txt"
# Get total number of cpus in cluster from REST action
CPU_COUNT=`curl -u $admin_user:$admin_password -k ${rest_url}jobs/${job_id}/cpucount`

# quick smoke test of multinode openmpi run,
# Quick smoke test of multinode openmpi run,
su - elasticwulf -c "mpirun -np $CPU_COUNT --hostfile /home/elasticwulf/openmpi_hostfile /home/elasticwulf/hello > cluster_mpi_smoketest.txt"

# kick off ruby command_runner.rb script (only on master node)
Expand All @@ -189,44 +190,4 @@ else
mount ${MASTER_HOSTNAME}:/mnt/elasticwulf /mnt/elasticwulf
# Send REST PUT to node url, signaling that NFS is ready on node..
curl -H "Content-Type: application/json" -H "Accept: application/json" -X PUT -d "{"node": {"nfs_mounted":"true"}}" -u $admin_user:$admin_password -k ${rest_url}jobs/${job_id}/nodes/${NODE_ID}
fi





# smoke test of local mpi installation
cat <<EOF >> /home/elasticwulf/hello.c
#include <stdio.h>
#include <mpi.h>
int main(int argc, char *argv[]) {
int numprocs, rank, namelen;
char processor_name[MPI_MAX_PROCESSOR_NAME];
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Get_processor_name(processor_name, &namelen);
printf("Process %d on %s out of %d\n", rank, processor_name, numprocs);
MPI_Finalize();
}
EOF

chown elasticwulf:elasticwulf /home/elasticwulf/hello.c

# Quick test of local openmpi
su - elasticwulf -c "mpicc /home/elasticwulf/hello.c -o /home/elasticwulf/hello"
### check number of processors available
# cat /proc/cpuinfo
su - elasticwulf -c "mpirun -np 2 /home/elasticwulf/hello > local_mpi_smoketest.txt"








fi
16 changes: 16 additions & 0 deletions lib/examples/hello.c
@@ -0,0 +1,16 @@
#include <stdio.h>
#include <mpi.h>

int main(int argc, char *argv[]) {
int numprocs, rank, namelen;
char processor_name[MPI_MAX_PROCESSOR_NAME];

MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Get_processor_name(processor_name, &namelen);

printf("Process %d on %s out of %d\n", rank, processor_name, numprocs);

MPI_Finalize();
}

0 comments on commit 7869bfe

Please sign in to comment.