Last active
February 6, 2019 20:28
-
-
Save Weffe/75e757425ac11010c5929f76ad575346 to your computer and use it in GitHub Desktop.
Makefile for ease of use with mpich docker container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FULL_PATH_CURR_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) | |
| start: | |
| # start up docker container and name it mpidev | |
| docker run --name mpidev -it --rm -v $(FULL_PATH_CURR_DIR):/project nlknguyen/alpine-mpich | |
| build: | |
| # compile code | |
| mpicc ./$(src).c -o $(src) | |
| run: | |
| # run it on 4 processors | |
| mpirun -n 4 ./$(src) | |
| brun: | |
| # build and immediately run on 4 processors | |
| mpicc ./$(src).c -o $(src) | |
| mpirun -n 4 ./$(src) | |
| # example usage | |
| # make start | |
| # Given that you have a file named better-hello.c | |
| # then once inside the interactive terminal you can still use these commands | |
| # make build src=better-hello | |
| # make run src=better-hello | |
| # or build and run immediately | |
| # make brun src=better-hello |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment