test2
4 years ago
1 changed files with 32 additions and 19 deletions
@ -1,24 +1,37 @@ |
|||
all: config install log |
|||
|
|||
|
|||
DIRhosts=/home/ubuntu/hosts |
|||
DIR=/home/ubuntu/ |
|||
swarmlab-getworkers > $(DIRhosts) |
|||
DIR=/home/ubuntu |
|||
options=-env I_MPI_DEBUG=3 |
|||
number=10 |
|||
|
|||
ex= |
|||
|
|||
helloworld: |
|||
@mpicc -o $(DIR)/mpi_hello_world ./mpi_hello_world.c ; \
|
|||
cat $DIRhosts | while read -r line ; \
|
|||
do \
|
|||
scp $(DIR)/mpi_hello_world ubuntu@$(line):$(DIR)/mpi_hello_world ; \
|
|||
done \
|
|||
mpirun -n 10 -f $(DIRhosts) $(DIR)/mpi_hello_world 2>&1 | tee /tmp/output.log ; \
|
|||
all: mpi_hello_world example |
|||
.PHONY: all |
|||
|
|||
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 |
|||
|
|||
cpi: |
|||
@mpicc -o $(DIR)/cpi ./cpi.c ; \
|
|||
cat $(DIRhosts) | while read -r line ; \
|
|||
do \
|
|||
scp $(DIR)/cpi ubuntu@$(line):$(DIR)/cpi.c ; \
|
|||
done \
|
|||
mpirun -n 10 -f $(DIRhosts) $(DIR)/cpi 2>&1 | tee /tmp/output.log ; \
|
|||
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\
|
|||
|
|||
|
Loading…
Reference in new issue