You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.2 KiB

5 years ago
DIRhosts=/home/ubuntu/hosts
5 years ago
DIR=/home/ubuntu
options=-env I_MPI_DEBUG=3
number=10
ex=
5 years ago
5 years ago
all: mpi_hello_world example
.PHONY: all
5 years ago
5 years ago
mpi_hello_world:
@swarmlab-getworkers > $(DIRhosts) ;\
mpicc ./mpi_hello_world.c -o $(DIR)/mpi_hello_world ;\
while read line; do\
echo "scp $(DIR)/mpi_hello_world ubuntu@$$line:$(DIR)/mpi_hello_world " ;\
scp $(DIR)/mpi_hello_world ubuntu@$$line:$(DIR)/mpi_hello_world ;\
echo "$$line" ;\
done < $(DIRhosts);\
echo "mpirun $(options) -wdir=$(DIR) -n $(number) -f $(DIRhosts) $(DIR)/mpi_hello_world" ; \
mpirun $(options) -wdir=$(DIR) -n $(number) -f $(DIRhosts) $(DIR)/mpi_hello_world
5 years ago
5 years ago
example:
@if [ ! -z $(ex) ]; then\
swarmlab-getworkers > $(DIRhosts) ;\
mpicc ./$(ex).c -o $(DIR)/$(ex) ;\
while read line; do\
echo "scp $(DIR)/$(ex) ubuntu@$$line:$(DIR)/$(ex) " ;\
scp $(DIR)/$(ex) ubuntu@$$line:$(DIR)/$(ex) ;\
echo "$$line" ;\
done < $(DIRhosts);\
echo "mpirun $(options) -wdir=$(DIR) -n $(number) -f $(DIRhosts) $(DIR)/$(ex)" ; \
mpirun $(options) -wdir=$(DIR) -n $(number) -f $(DIRhosts) $(DIR)/$(ex) ; \
else\
echo "usage: make example ex=source file" ; \
echo "e.g.: make example ex=mv" ; \
fi\
5 years ago