Skip to content

Commit ea2993e

Browse files
committed
Refactor
* Add A* search * Add squash reads * Add held variables * Refactor file structure * Implement Closure * Implement IncludeSet * Revamp Closure using vector clock algorithm * Add parallel execution * Clean up makefile * Remove extra traces, logs, scripts
1 parent 6acba76 commit ea2993e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+1795
-6074702
lines changed

README.md

+32-12
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,49 @@
66

77
## Building and Running
88

9+
### Building
910
To build:
1011
```sh
1112
make all
1213
```
1314

15+
### Command Line flags
16+
The executable `verify_sc` takes in the following flags:
17+
18+
- `-v`, `--verbose`
19+
- Prints more verbose output to stdout
20+
- `-w`, `--witness`
21+
- Enables generation of witness for data races predicted
22+
- `-o <OUTPUT_DIR>`, `--outputDir <OUTPUT_DIR>`
23+
- <OUTPUT_DIR> for generated witness
24+
- Requires `-w` or `--witness` flag for witnesses to be generated
25+
- `-p <NUM_THREADS>`, `--parallel <NUM_THREADS>`
26+
- Execute <NUM_THREADS> in parallel
27+
28+
All flags are optional.
29+
30+
### Running
1431
To run:
32+
1533
```sh
16-
make run INPUT=<INPUT_FILE>
34+
./bin/verify_sc <INPUT_TRACE> -v -w -o <WITNESS_DIR> -p <NUM_THREADS>
1735
```
1836

19-
To run with debug info enabled:
20-
37+
For convenience, some additional makefile targets are provided:
2138
```sh
22-
make debug INPUT=<INPUT_FILE>
39+
make run INPUT=<INPUT_FILE> NUM_THREADS=<NUM_THREADS>
2340
```
2441

25-
## Trace Generation
42+
This combines building and running together. Witness generation, however, is disabled for speed. Modify the makefile as needed.
2643

27-
The chosen format for an event is an `uint64_t` as follows:
28-
- 4 bits event identifier
29-
- 8 bits thread identifier
30-
- 20 bits variable
31-
32-
This project reads and parses traces from a binary file where each event is represented using the above format.
3344

34-
For convenience, scripts are provided to convert human-readable as well as STD format to the binary format expected. Use one of `make gen_from_std_trace` to convert to human-readable format and `make gen_traces` to convert from human-readable format to the required binary file.
45+
## Trace Format
46+
~enumerate_race_detection~ support the following events:
47+
- Read/Write
48+
- Acquire/Release
49+
- Begin/End
50+
- Fork/Join
51+
52+
Each event are represented using 64 bits: 4 bits event identifier, 8 bits thread identifier, 20 bits variable dentifer, 32 bits variable value.
53+
54+
Input traces are assumed to be binary files where each line consists of a 64 bit representing an event.

logs/csv/input9.csv

-33
This file was deleted.

logs/csv/input9_2.csv

-33
This file was deleted.

logs/meta/input9.txt

-31
This file was deleted.

makefile

+10-63
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,39 @@
11
CXX = g++
2-
CXXFLAGS = -std=c++17
2+
CXXFLAGS = -std=c++20
33

44
DEBUGFLAGS = -DDEBUG
55

66
BIN_DIR=bin
77
SRC_DIR=src
88

99
TRACE_DIR=trace
10-
STD_TRACE_DIR=$(TRACE_DIR)/STD_Format
11-
TEST_TRACE_DIR=$(TRACE_DIR)/test
12-
HUMANREADABLE_TRACE_DIR=$(TRACE_DIR)/human_readable_trace
13-
FORMATTED_TRACE_DIR=$(TRACE_DIR)/binary_trace
10+
WITNESS_DIR=witness
1411

1512
TARGET = $(BIN_DIR)/verify_sc
16-
TRACE_GENERATOR = $(BIN_DIR)/trace_generator
1713

18-
SRC = $(SRC_DIR)/main.cpp
19-
DEPS = $(wildcard $(SRC_DIR)/common/*.cpp) $(wildcard $(SRC_DIR)/consistency_checker/.cpp) $(SRC_DIR)/parsing/parser.cpp
14+
SRC = $(wildcard $(SRC_DIR)/*.cpp)
15+
DEPS = $(wildcard $(SRC_DIR)/*.hpp)
2016

21-
TRACE_GENERATOR_SRC = $(SRC_DIR)/trace_generator.cpp
22-
TRACE_GENERATOR_DEPS = $(SRC_DIR/common/event.cpp) $(SRC_DIR/parsing/trace_conversion.cpp)
23-
24-
STD_CONVERTER=scripts/convert.py
25-
TEST_CONVERTER=scripts/convert_test.py
26-
27-
readable_traces = $(shell ls $(HUMANREADABLE_TRACE_DIR)/*.txt)
28-
INPUT = trace/binary_trace/input1.txt
29-
SIZE = 100
30-
31-
CSV_GENERATOR = scripts/benchmark_to_csv.py
32-
LOG_DIR = logs/output
33-
CSV_DIR = logs/csv
34-
35-
PREP_CSV_GENERATOR = scripts/prep_csv.py
36-
PREP_CSV_DIR = logs/combined
17+
INPUT = input.txt
18+
NUM_THREADS = 8
3719

3820
all: $(TARGET)
3921

4022
run: clean $(TARGET)
4123
@echo "Running with input file: $(INPUT)"
4224
@echo ""
43-
@./$(TARGET) $(INPUT) -s $(SIZE) -v
25+
@./$(TARGET) $(INPUT) -v -o $(WITNESS_DIR) -p $(NUM_THREADS)
4426

4527
debug: clean $(SRC) $(DEPS)
4628
mkdir -p $(BIN_DIR)
4729
$(CXX) $(CXXFLAGS) $(DEBUGFLAGS) -o $(TARGET) $(SRC)
48-
./$(TARGET) $(INPUT) -s $(SIZE) -v
49-
50-
benchmark: clean $(SRC) $(DEPS)
51-
mkdir -p $(BIN_DIR)
52-
$(CXX) $(CXXFLAGS) $(DEBUGFLAGS) -o $(TARGET) $(SRC)
53-
command time -v ./$(TARGET) $(INPUT) -s $(SIZE) -v
30+
./$(TARGET) $(INPUT) -v -o $(WITNESS_DIR) -p $(NUM_THREADS)
5431

5532
$(TARGET): $(SRC) $(DEPS)
5633
mkdir -p $(BIN_DIR)
5734
$(CXX) $(CXXFLAGS) -o $(TARGET) $(SRC)
5835

59-
$(TRACE_GENERATOR): $(TRACE_GENERATOR_SRC) $(TRACE_GENERATOR_DEPS)
60-
mkdir -p $(BIN_DIR)
61-
$(CXX) $(CXXFLAGS) -o $(TRACE_GENERATOR) $(TRACE_GENERATOR_SRC)
62-
63-
gen_from_std_trace:
64-
mkdir -p $(HUMANREADABLE_TRACE_DIR)
65-
python3 $(STD_CONVERTER) $(STD_TRACE_DIR) $(HUMANREADABLE_TRACE_DIR)
66-
67-
gen_single_trace: $(TRACE_GENERATOR)
68-
mkdir -p $(FORMATTED_TRACE_DIR)
69-
$(TRACE_GENERATOR) $(args) $(FORMATTED_TRACE_DIR)
70-
71-
gen_from_test_trace:
72-
mkdir -p $(HUMANREADABLE_TRACE_DIR)
73-
python3 $(TEST_CONVERTER) $(TEST_TRACE_DIR) $(HUMANREADABLE_TRACE_DIR)
74-
75-
gen_traces: $(TRACE_GENERATOR)
76-
mkdir -p $(FORMATTED_TRACE_DIR)
77-
@for file in $(readable_traces); do \
78-
echo "Generating trace for $$file..."; \
79-
$(TRACE_GENERATOR) $$file $(FORMATTED_TRACE_DIR);\
80-
done
81-
82-
.PHONY = gen_csv prep_csv
83-
gen_csv:
84-
python3 $(CSV_GENERATOR) $(LOG_DIR) $(CSV_DIR)
85-
86-
prep_csv:
87-
rm $(PREP_CSV_DIR)/*
88-
python3 $(PREP_CSV_GENERATOR) $(CSV_DIR) $(PREP_CSV_DIR)
89-
9036
# Clean target to remove the compiled files
9137
clean:
92-
rm -f $(TARGET) $(TRACE_GENERATOR) $(TARGET_STRICT)
38+
rm -f $(TARGET)
39+
rm -rf $(WTINESS_DIR)

scripts/benchmark.sh

-22
This file was deleted.

scripts/benchmark_to_csv.py

-86
This file was deleted.

0 commit comments

Comments
 (0)