MakeFiles

Defining the variables. Note: pathes should be provided without quotes!

MAIN_DIR := training
TRAIN_DIR := $(MAIN_DIR)/train/$(PROJECT_NAME)_$(RUN)

ifdef HANDLED_CHECKPOINT
    LATEST_CHECKPOINT = $(HANDLED_CHECKPOINT)
else
    LATEST_CHECKPOINT = $(shell $(GET_LATEST_CHECKPOINT))
endif

execute shell command

GET_LATEST_CHECKPOINT = find $(TRAIN_DIR) -name 'model*' | awk -F '.' '{print $$2}' | awk -F '-' '{print $$2}' | sort -g | tail -n 1
LATEST_CHECKPOINT = $(shell $(GET_LATEST_CHECKPOINT))

define some commands

# merge command together
clean-all: clean-train clean-val

clean-train:
    rm -rf $(TRAIN_DIR)/*

clean-val:
    rm -rf $(EVAL_DIR)/*

set environment variables

CUDA_VISIBLE_DEVICES=$(TRAIN_CUDA) python train.py