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