forked from instadeepai/Mava
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·70 lines (56 loc) · 1.8 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Check if GPU is available
NVCC_RESULT := $(shell which nvcc 2> NULL)
NVCC_TEST := $(notdir $(NVCC_RESULT))
ifeq ($(NVCC_TEST),nvcc)
GPUS=--gpus all
else
GPUS=
endif
# For Windows use CURDIR
ifeq ($(PWD),)
PWD := $(CURDIR)
endif
# Set flag for docker run command
BASE_FLAGS=-it --rm -v ${PWD}:/home/app/mava -w /home/app/mava
RUN_FLAGS=$(GPUS) $(BASE_FLAGS)
RUN_FLAGS_TENSORBOARD=$(GPUS) -p 6006:6006 $(BASE_FLAGS)
# Default version is jax-core
version = jax-core
DOCKER_IMAGE_NAME = mava
DOCKER_IMAGE_TAG = $(version)
IMAGE = $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)-latest
DOCKER_RUN=docker run $(RUN_FLAGS) $(IMAGE)
DOCKER_RUN_TENSORBOARD=docker run $(RUN_FLAGS_TENSORBOARD) $(IMAGE)
# Choose correct image for example
ifneq (,$(findstring debugging,$(example)))
DOCKER_IMAGE_TAG=jax-core
else ifneq (,$(findstring petting,$(example)))
DOCKER_IMAGE_TAG=pz
else ifneq (,$(findstring flatland,$(example)))
DOCKER_IMAGE_TAG=flatland
else ifneq (,$(findstring smac,$(example)))
DOCKER_IMAGE_TAG=sc2
endif
# make file commands
build:
DOCKER_BUILDKIT=1 docker build --tag $(IMAGE) --target $(DOCKER_IMAGE_TAG) --build-arg record=$(record) .
run:
$(DOCKER_RUN) python $(example) --base_dir /home/app/mava/logs/
run-tensorboard:
$(DOCKER_RUN_TENSORBOARD) /bin/bash -c " tensorboard --bind_all --logdir /home/app/mava/logs/ & python $(example) --base_dir /home/app/mava/logs/; "
run-record:
$(DOCKER_RUN) /bin/bash -c "./bash_scripts/startup_screen.sh ; python $(example) --base_dir /home/app/mava/logs/ "
bash:
$(DOCKER_RUN) bash
run-tests:
$(DOCKER_RUN) /bin/bash bash_scripts/local_tests.sh
run-integration-tests:
$(DOCKER_RUN) /bin/bash bash_scripts/local_tests.sh true
run-checks:
$(DOCKER_RUN) /bin/bash bash_scripts/check_format.sh
push:
docker login
-docker push $(IMAGE)
docker logout
pull:
docker pull $(IMAGE)