mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-08 04:05:43 -05:00
Makefile for benchs.
This commit is contained in:
parent
3422634923
commit
b6aa6ed2fc
3 changed files with 31 additions and 51 deletions
|
|
@ -1,27 +1,28 @@
|
||||||
SOLVER =../sat_solve.native
|
SOLVER :=../sat_solve.native
|
||||||
OPTIONS =-t 30s -s 1G
|
OPTIONS :=-t 30s -s 1G
|
||||||
CMD = $(SOLVER) $(OPTIONS)
|
|
||||||
|
|
||||||
LOGDIR := logs
|
LOGDIR := $(shell echo "logs/`git rev-parse HEAD`")
|
||||||
LOG := $(shell date +'$(LOGDIR)/sat_%Y-%m-%d-%H%M')
|
LOGDIRE := $(shell echo "logs\/`git rev-parse HEAD`")
|
||||||
CNF := $(shell find ./ -name "*.cnf" -type f)
|
INDEX := $(shell echo "$(LOGDIR)/index")
|
||||||
DONE := $(CNF:.cnf=.done)
|
CNF := $(shell find ./ -name "*.cnf" -type f)
|
||||||
|
DONE := $(addprefix $(LOGDIR)/raw/, $(CNF:.cnf=.done))
|
||||||
|
|
||||||
all: $(LOG) $(DONE)
|
PROVER := $(shell echo "$(LOGDIR)/prover")
|
||||||
@find ./ -name "*.done" -type f -delete
|
CMD := $(PROVER) $(OPTIONS)
|
||||||
|
|
||||||
|
all: $(INDEX)
|
||||||
@echo "All done."
|
@echo "All done."
|
||||||
|
|
||||||
$(LOG):
|
$(INDEX): $(PROVER) $(DONE)
|
||||||
@mkdir -p $(LOGDIR)
|
@echo "Ended at `date +'%H:%M:%S %d/%m/%Y'`" > $(INDEX)
|
||||||
@touch $(LOG)
|
@echo "Index created"
|
||||||
@echo "Log file : $(LOG)"
|
|
||||||
@echo "Date : `date +'%H:%M %d-%m-%Y'`" | tee -a $(LOG)
|
|
||||||
@echo "Command : '$(CMD)'" | tee -a $(LOG)
|
|
||||||
@echo "Commit : `git rev-parse HEAD`" | tee -a $(LOG)
|
|
||||||
|
|
||||||
%.done : %.cnf $(LOG)
|
$(PROVER):
|
||||||
@./run_prover "$(CMD)" "$*" "$(LOG)"
|
@echo "Creating log directory..." && mkdir -p $(LOGDIR)/raw
|
||||||
@touch $*.done
|
@echo "Copying prover..." && cp $(SOLVER) $(PROVER)
|
||||||
|
|
||||||
|
$(LOGDIR)/raw/%.done : $(PROVER)
|
||||||
|
@mkdir -p $(dir $@)
|
||||||
|
@echo "solving problem $*.cnf..."
|
||||||
|
@./run_prover "$(CMD)" "$*.cnf" "$@"
|
||||||
|
|
||||||
clean:
|
|
||||||
@find ./ -name "*.done" -type f -delete
|
|
||||||
|
|
|
||||||
26
bench/run
26
bench/run
|
|
@ -1,26 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
CURDIR=`dirname $0`
|
|
||||||
SOLVER="$CURDIR/../sat_solve.native"
|
|
||||||
|
|
||||||
solvertest () {
|
|
||||||
for f in `find -L $1 -name *.cnf -type f`
|
|
||||||
do
|
|
||||||
echo -ne "\r\033[KTesting $f..."
|
|
||||||
"$SOLVER" -t 5s -s 1G $f | grep $2 > /dev/null 2> /dev/null
|
|
||||||
RET=$?
|
|
||||||
if [ $RET -ne 0 ];
|
|
||||||
then
|
|
||||||
echo -e "\r\033[K\e[31m[KO]\e[0m $f"
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo -e "\r\033[K\e[32m[OK]\e[0m $2"
|
|
||||||
}
|
|
||||||
|
|
||||||
all () {
|
|
||||||
solvertest "$CURDIR/flatgraph/" "Sat"
|
|
||||||
solvertest "$CURDIR/morphgraph/" "Sat"
|
|
||||||
}
|
|
||||||
|
|
||||||
time all
|
|
||||||
|
|
@ -1,7 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
CMD="$0"
|
CMD="$1"
|
||||||
FILE="$1"
|
FILE="$2"
|
||||||
LOG="$2"
|
LOG="$3"
|
||||||
|
|
||||||
sleep 1
|
/usr/bin/time -f "%e" $CMD $FILE > $3 2>&1
|
||||||
|
RET=$?
|
||||||
|
if [ $RET -ne 0 ];
|
||||||
|
then
|
||||||
|
echo "Error code $RET while solving $FILE"
|
||||||
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue