Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid unnecessary rebuilds when building for Linux #618

Merged
merged 2 commits into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Data generator for sdk/examples/idash2017-logistic-regression
# External data, edin.txt idash.txt lbw.txt nhanes3.txt pcs.txt and uis.txt,
# can be found in https://github.com/kimandrik/IDASH2017/tree/master/IDASH2017/data
# External data (SOURCE_FILES) can be found in
# https://github.com/kimandrik/IDASH2017/tree/master/IDASH2017/data
#
# AUTHORS
#
Expand All @@ -18,14 +18,14 @@ SIGMOID = 5
GAMMA_UP = 1
GAMMA_DOWN = -1
INDICE_SUFFIX = $(addprefix -data-,$(addsuffix .dat,$(shell seq 0 $(shell expr $(FOLD) - 1))))
TARGET_DATS = $(foreach base_name,$(basename $(SOURCE_FILES)),$(addprefix $(base_name),$(INDICE_SUFFIX)) )
TARGET_DIR = ../../datasets/idash2017/
TARGET_DIR_DATS = $(addprefix $(TARGET_DIR),$(TARGET_DATS))
TARGET_DATS = $(foreach base_name,$(basename $(SOURCE_FILES)),$(addprefix $(base_name),$(INDICE_SUFFIX)) )
TARGET_DIR = ../../datasets/idash2017
TARGET_DIR_DATS = $(addprefix $(TARGET_DIR)/,$(TARGET_DATS))
GENERATED_DATA_FILE_PREFIX = generate
GENERATED_DATA_ROW ?= 200
GENERATED_DATA_COL ?= 20
GENERATED_DATA_TARGET_DATS = $(addprefix $(GENERATED_DATA_FILE_PREFIX),$(INDICE_SUFFIX))
GENERATED_DATA_TARGET_DIR_DATS = $(addprefix $(TARGET_DIR),$(GENERATED_DATA_TARGET_DATS))
GENERATED_DATA_TARGET_DIR_DATS = $(addprefix $(TARGET_DIR)/,$(GENERATED_DATA_TARGET_DATS))
SEED = 0
COMMON_CONFIG = --fold=$(FOLD) --num_of_iter=$(NUM_ITER) --sigmoid=$(SIGMOID) --gamma_up=$(GAMMA_UP) --gamma_down=$(GAMMA_DOWN) --seed=$(SEED)
RUN_COMMAND ?= cargo run --
Expand All @@ -34,27 +34,22 @@ RUN_COMMAND ?= cargo run --

all: $(GENERATED_DATA_TARGET_DIR_DATS)

.SECONDEXPANSION:
$(GENERATED_DATA_TARGET_DIR_DATS): %.dat : $$(notdir $$@) $(TARGET_DIR)
cp $< $@
$(TARGET_DIR)/%.dat: %.dat | $(TARGET_DIR)
cp $< $@

$(GENERATED_DATA_TARGET_DATS) : %.dat :
$(GENERATED_DATA_TARGET_DATS) &:
$(RUN_COMMAND) $(COMMON_CONFIG) generate --file_prefix=$(GENERATED_DATA_FILE_PREFIX) \
--row=$(GENERATED_DATA_ROW) --column=$(GENERATED_DATA_COL)

$(TARGET_DIR):
mkdir -p $(TARGET_DIR)
mkdir -p $@

# Target for generating data from external resources,
# edin.txt idash.txt lbw.txt nhanes3.txt pcs.txt and uis.txt,
# which can be found in https://github.com/kimandrik/IDASH2017/tree/master/IDASH2017/data
external: $(TARGET_DIR_DATS)

.SECONDEXPANSION:
$(TARGET_DIR_DATS): %.dat : $$(notdir $$@) $(TARGET_DIR)
cp $< $@

$(TARGET_DATS) : %.dat : $(SOURCE_FILES)
$(TARGET_DATS) &: $(SOURCE_FILES)
$(RUN_COMMAND) $(COMMON_CONFIG) external --input_file=edin.txt --is_label_first=false
$(RUN_COMMAND) $(COMMON_CONFIG) external --input_file=idash.txt --is_label_first=true
$(RUN_COMMAND) $(COMMON_CONFIG) external --input_file=lbw.txt --is_label_first=false
Expand All @@ -68,11 +63,7 @@ clean:
rm -f *.csv
rm -rf $(TARGET_DIR)

quick-clean:
cargo clean
rm -f *.dat
rm -f *.csv
rm -rf $(TARGET_DIR)
quick-clean: clean

fmt:
cargo fmt
Expand Down
16 changes: 6 additions & 10 deletions examples/data-generators/image-processing-generator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,19 @@ WIDTH = 1024
HEIGHT = 1024
TARGET_PREFIX = image-processing
TARGET_DAT = $(addprefix $(TARGET_PREFIX), .png)
TARGET_DIR = ../../datasets/
TARGET_DIR_DAT = $(addprefix $(TARGET_DIR),$(TARGET_DAT))
TARGET_DIR = ../../datasets
TARGET_DIR_DAT = $(addprefix $(TARGET_DIR)/,$(TARGET_DAT))
RUN_COMMAND ?= cargo run --

.PHONY: all clean quick-clean fmt fmt-check

all: $(TARGET_DIR_DAT)

.SECONDEXPANSION:
$(TARGET_DIR_DAT): %.png : $$(notdir $$@) $(TARGET_DIR)
cp $< $@
$(TARGET_DIR)/%.png: %.png | $(TARGET_DIR)
cp $< $@

$(TARGET_DIR):
mkdir -p $(TARGET_DIR)
mkdir -p $@

$(TARGET_DAT):
$(RUN_COMMAND) --file_prefix $(TARGET_PREFIX) --image_path $(IMAGE_PATH) --width $(WIDTH) --height $(HEIGHT);
Expand All @@ -37,10 +36,7 @@ clean:
rm -f *.png
rm -f $(TARGET_DIR_DAT)

quick-clean:
cargo clean
rm -f *.png
rm -f $(TARGET_DIR_DAT)
quick-clean: clean

fmt:
cargo fmt
Expand Down
18 changes: 7 additions & 11 deletions examples/data-generators/intersection-set-sum-generator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,29 @@ SIZE = 100
DIFF = 25
TARGET_DATS = $(addprefix $(FILE_PREFIX)-,advertisement-viewer.dat customer.dat)
SEED = 0
TARGET_DIR = ../../datasets/
TARGET_DIR_DATS = $(addprefix $(TARGET_DIR),$(TARGET_DATS))
TARGET_DIR = ../../datasets
TARGET_DIR_DATS = $(addprefix $(TARGET_DIR)/,$(TARGET_DATS))
RUN_COMMAND ?= cargo run --

.PHONY: all clean quick-clean fmt fmt-check

all: $(TARGET_DIR_DATS)

.SECONDEXPANSION:
$(TARGET_DIR_DATS): %.dat : $$(notdir $$@) $(TARGET_DIR)
cp $< $@
$(TARGET_DIR)/%.dat: %.dat | $(TARGET_DIR)
cp $< $@

$(TARGET_DIR):
mkdir -p $(TARGET_DIR)
mkdir -p $@

$(TARGET_DATS) : %.dat : $(SOURCE_FILES)
$(TARGET_DATS) &: $(SOURCE_FILES)
$(RUN_COMMAND) --file_prefix $(FILE_PREFIX) --size $(SIZE) --num_of_diff $(DIFF) --seed $(SEED)

clean:
cargo clean
rm -f *.dat
rm -f $(TARGET_DIR_DATS)

quick-clean:
cargo clean
rm -f *.dat
rm -f $(TARGET_DIR_DATS)
quick-clean: clean

fmt:
cargo fmt
Expand Down
17 changes: 6 additions & 11 deletions examples/data-generators/linear-regression-generator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,20 @@

ROW = 10000
TARGET_DAT = linear-regression.dat
TARGET_DIR = ../../datasets/
TARGET_DIR_DAT = $(addprefix $(TARGET_DIR),$(TARGET_DAT))
TARGET_DIR = ../../datasets
TARGET_DIR_DAT = $(addprefix $(TARGET_DIR)/,$(TARGET_DAT))
SEED = 0
RUN_COMMAND ?= cargo run --

.PHONY: all clean quick-clean fmt fmt-check

all: $(TARGET_DIR_DAT)

.SECONDEXPANSION:
$(TARGET_DIR_DAT): %.dat : $$(notdir $$@) $(TARGET_DIR)
cp $< $@
$(TARGET_DIR)/%.dat: %.dat | $(TARGET_DIR)
cp $< $@

$(TARGET_DIR):
mkdir -p $(TARGET_DIR)
mkdir -p $@

$(TARGET_DAT):
$(RUN_COMMAND) --file_name $(basename $@) --size $(ROW) --seed $(SEED)
Expand All @@ -36,11 +35,7 @@ clean:
rm -f *.txt
rm -f $(TARGET_DIR_DAT)

quick-clean:
cargo clean
rm -f *.dat
rm -f *.txt
rm -f $(TARGET_DIR_DAT)
quick-clean: clean

fmt:
cargo fmt
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Data generator sdk/examples/moving-average-convergence-divergence
# External data, apple_prices.csv
# can be found on https://github.com/woonhulktin/HETSA/tree/master/GeneralToolbox/FinancialApplications/macd-Plaintext/data
# External data, apple_prices.csv, can be found at
# https://raw.githubusercontent.com/ht-weng/HETSA/master/FinancialApplications/data/apple_prices.csv
#
# AUTHORS
#
Expand All @@ -11,43 +11,37 @@
# See the `LICENSE_MIT.markdown` file in the Veracruz root directory for licensing
# and copyright information.


SOURCE_FILES = apple_prices.csv
# The range of data
RANGE ?= $(shell seq 1000 20 1000)
INDICE_SUFFIX = $(addprefix -,$(addsuffix .dat,$(RANGE)))
TARGET_DATS = $(foreach base_name,$(basename $(SOURCE_FILES)),$(addprefix $(base_name),$(INDICE_SUFFIX)) )
TARGET_DIR = ../../datasets/macd/
TARGET_DIR_DATS = $(addprefix $(TARGET_DIR),$(TARGET_DATS))
TARGET_DATS = $(foreach base_name,$(basename $(SOURCE_FILES)),$(addprefix $(base_name),$(INDICE_SUFFIX)) )
TARGET_DIR = ../../datasets/macd
TARGET_DIR_DATS = $(addprefix $(TARGET_DIR)/,$(TARGET_DATS))
GENERATED_DATA_FILE_PREFIX = generate
GENERATED_DATA_TARGET_DATS = $(addprefix $(GENERATED_DATA_FILE_PREFIX),$(INDICE_SUFFIX))
GENERATED_DATA_TARGET_DIR_DATS = $(addprefix $(TARGET_DIR),$(GENERATED_DATA_TARGET_DATS))
GENERATED_DATA_TARGET_DIR_DATS = $(addprefix $(TARGET_DIR)/,$(GENERATED_DATA_TARGET_DATS))
SEED = 0
RUN_COMMAND ?= cargo run --

.PHONY: all clean external quick-clean fmt fmt-check

all: $(GENERATED_DATA_TARGET_DIR_DATS)

.SECONDEXPANSION:
$(GENERATED_DATA_TARGET_DIR_DATS): %.dat : $$(notdir $$@) $(TARGET_DIR)
cp $< $@
$(TARGET_DIR)/%.dat: %.dat | $(TARGET_DIR)
cp $< $@

$(GENERATED_DATA_TARGET_DATS) : %.dat :
$(GENERATED_DATA_TARGET_DATS) &:
for number in $(RANGE) ; do \
$(RUN_COMMAND) generate --file_prefix $(GENERATED_DATA_FILE_PREFIX) --size $$number --seed $(SEED); \
done

$(TARGET_DIR):
mkdir -p $(TARGET_DIR)
mkdir -p $@

external: $(TARGET_DIR_DATS)

.SECONDEXPANSION:
$(TARGET_DIR_DATS): %.dat : $$(notdir $$@) $(TARGET_DIR)
cp $< $@

$(TARGET_DATS) : %.dat : $(SOURCE_FILES)
$(TARGET_DATS) &: $(SOURCE_FILES)
for number in $(RANGE) ; do \
$(RUN_COMMAND) external --input_file $< --size $$number ; \
done
Expand All @@ -57,10 +51,7 @@ clean:
rm -f *.dat
rm -rf $(TARGET_DIR)

quick-clean:
cargo clean
rm -f *.dat
rm -rf $(TARGET_DIR)
quick-clean: clean

fmt:
cargo fmt
Expand Down
Loading