diff options
54 files changed, 317 insertions, 446 deletions
diff --git a/all_pairs/Makefile b/all_pairs/Makefile index 36cf55a..0042372 100644 --- a/all_pairs/Makefile +++ b/all_pairs/Makefile | |||
@@ -1,57 +1,73 @@ | |||
1 | CC = gcc | 1 | LIBLITMUS ?= /media/speedy/litmus/liblitmus |
2 | CFLAGS = -pthread -O2 | 2 | CC ?= gcc |
3 | CFLAGS = -pthread -O2 -I.. -DPAIRED | ||
3 | LDFLAGS = -lrt | 4 | LDFLAGS = -lrt |
4 | all: bin/cjpeg_wrbmp bin/huff_enc bin/gsm_enc bin/dijkstra bin/h264_dec bin/susan bin/adpcm_enc bin/rijndael_dec bin/huff_dec bin/rijndael_enc bin/gsm_dec bin/anagram bin/epic bin/ammunition bin/g723_enc bin/ndes bin/petrinet bin/statemate bin/cjpeg_transupp bin/mpeg2 bin/fmref bin/audiobeam bin/adpcm_dec bin/cleanupSemaphores | 5 | COMMON = ../extra.h |
6 | |||
7 | # Handle cases where we're also profiling with the MMDC on the i.MX6Q | ||
8 | ifneq ($(shell grep "define MMDC 1" ../extra.h),) | ||
9 | COMMON += /media/speedy/litmus/tools/mmdc/mmdc.c | ||
10 | endif | ||
11 | |||
12 | # Include all the LITMUS^RT headers if we're using it | ||
13 | ifneq ($(shell grep "define LITMUS 1" ../extra.h),) | ||
14 | CFLAGS += -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include | ||
15 | LDFLAGS += -L${LIBLITMUS} -llitmus | ||
16 | endif | ||
17 | |||
18 | all: bin/cjpeg_wrbmp bin/huff_enc bin/gsm_enc bin/dijkstra bin/h264_dec bin/susan bin/adpcm_enc bin/rijndael_dec bin/huff_dec bin/rijndael_enc bin/gsm_dec bin/anagram bin/epic bin/ammunition bin/g723_enc bin/ndes bin/petrinet bin/statemate bin/cjpeg_transupp bin/mpeg2 bin/fmref bin/audiobeam bin/adpcm_dec | ||
19 | |||
20 | debug: all | ||
21 | debug: CFLAGS += -ggdb3 | ||
5 | 22 | ||
6 | .PHONY: clean | 23 | .PHONY: clean |
7 | clean: | 24 | clean: |
8 | rm bin/cjpeg_wrbmp bin/huff_enc bin/gsm_enc bin/dijkstra bin/h264_dec bin/susan bin/adpcm_enc bin/rijndael_dec bin/huff_dec bin/rijndael_enc bin/gsm_dec bin/anagram bin/epic bin/ammunition bin/g723_enc bin/ndes bin/petrinet bin/statemate bin/cjpeg_transupp bin/mpeg2 bin/fmref bin/audiobeam bin/adpcm_dec bin/cleanupSemaphores | 25 | rm -f bin/cjpeg_wrbmp bin/huff_enc bin/gsm_enc bin/dijkstra bin/h264_dec bin/susan bin/adpcm_enc bin/rijndael_dec bin/huff_dec bin/rijndael_enc bin/gsm_dec bin/anagram bin/epic bin/ammunition bin/g723_enc bin/ndes bin/petrinet bin/statemate bin/cjpeg_transupp bin/mpeg2 bin/fmref bin/audiobeam bin/adpcm_dec |
9 | 26 | ||
10 | bin/cleanupSemaphores: ./source/extra.h ./source/cleanupSemaphores.c | 27 | bin/cjpeg_wrbmp: ${COMMON} ./source/cjpeg_wrbmp/cjpeg_wrbmp.c ./source/cjpeg_wrbmp/input.c |
11 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | ||
12 | bin/cjpeg_wrbmp: ./source/extra.h ./source/cjpeg_wrbmp/cjpeg_wrbmp.c ./source/cjpeg_wrbmp/input.c | ||
13 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 28 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
14 | bin/huff_enc: ./source/extra.h ./source/huff_enc/huff_enc.c | 29 | bin/huff_enc: ${COMMON} ./source/huff_enc/huff_enc.c |
15 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 30 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
16 | bin/gsm_enc: ./source/extra.h ./source/gsm_enc/gsm_enc.c | 31 | bin/gsm_enc: ${COMMON} ./source/gsm_enc/gsm_enc.c |
17 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 32 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
18 | bin/dijkstra: ./source/extra.h ./source/dijkstra/dijkstra.c ./source/dijkstra/input.c | 33 | bin/dijkstra: ${COMMON} ./source/dijkstra/dijkstra.c ./source/dijkstra/input.c |
19 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 34 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
20 | bin/h264_dec: ./source/extra.h ./source/h264_dec/h264_dec.c ./source/h264_dec/h264_decinput.c | 35 | bin/h264_dec: ${COMMON} ./source/h264_dec/h264_dec.c ./source/h264_dec/h264_decinput.c |
21 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 36 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
22 | bin/susan: ./source/extra.h ./source/susan/input.c ./source/susan/susan.c ./source/susan/wccfile.c ./source/susan/wcclibm.c ./source/susan/wccmalloc.c | 37 | bin/susan: ${COMMON} ./source/susan/input.c ./source/susan/susan.c ./source/susan/wccfile.c ./source/susan/wcclibm.c ./source/susan/wccmalloc.c |
23 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 38 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
24 | bin/adpcm_enc: ./source/extra.h ./source/adpcm_enc/adpcm_enc.c | 39 | bin/adpcm_enc: ${COMMON} ./source/adpcm_enc/adpcm_enc.c |
25 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 40 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
26 | bin/rijndael_dec: ./source/extra.h ./source/rijndael_dec/aes.c ./source/rijndael_dec/input_small_enc.c ./source/rijndael_dec/rijndael_dec.c ./source/rijndael_dec/rijndael_dec_libc.c | 41 | bin/rijndael_dec: ${COMMON} ./source/rijndael_dec/aes.c ./source/rijndael_dec/input_small_enc.c ./source/rijndael_dec/rijndael_dec.c ./source/rijndael_dec/rijndael_dec_libc.c |
27 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 42 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
28 | bin/huff_dec: ./source/extra.h ./source/huff_dec/huff_dec.c | 43 | bin/huff_dec: ${COMMON} ./source/huff_dec/huff_dec.c |
29 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 44 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
30 | bin/rijndael_enc: ./source/extra.h ./source/rijndael_enc/aes.c ./source/rijndael_enc/input_small.c ./source/rijndael_enc/rijndael_enc.c ./source/rijndael_enc/rijndael_enc_libc.c | 45 | bin/rijndael_enc: ${COMMON} ./source/rijndael_enc/aes.c ./source/rijndael_enc/input_small.c ./source/rijndael_enc/rijndael_enc.c ./source/rijndael_enc/rijndael_enc_libc.c |
31 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 46 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
32 | bin/gsm_dec: ./source/extra.h ./source/gsm_dec/gsm_dec.c | 47 | bin/gsm_dec: ${COMMON} ./source/gsm_dec/gsm_dec.c |
33 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 48 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
34 | bin/anagram: ./source/extra.h ./source/anagram/anagram.c ./source/anagram/anagram_input.c ./source/anagram/anagram_stdlib.c | 49 | bin/anagram: ${COMMON} ./source/anagram/anagram.c ./source/anagram/anagram_input.c ./source/anagram/anagram_stdlib.c |
35 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 50 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
36 | bin/epic: ./source/extra.h ./source/epic/epic.c | 51 | bin/epic: ${COMMON} ./source/epic/epic.c |
37 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 52 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
38 | bin/ammunition: ./source/extra.h ./source/ammunition/ammunition.c ./source/ammunition/ammunition_libc.c ./source/ammunition/arithm.c ./source/ammunition/bits.c | 53 | bin/ammunition: ${COMMON} ./source/ammunition/ammunition.c ./source/ammunition/ammunition_libc.c ./source/ammunition/arithm.c ./source/ammunition/bits.c |
39 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 54 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
40 | bin/g723_enc: ./source/extra.h ./source/g723_enc/g723_enc.c | 55 | bin/g723_enc: ${COMMON} ./source/g723_enc/g723_enc.c |
41 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 56 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
42 | bin/ndes: ./source/extra.h ./source/ndes/ndes.c | 57 | bin/ndes: ${COMMON} ./source/ndes/ndes.c |
43 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 58 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
44 | bin/petrinet: ./source/extra.h ./source/petrinet/petrinet.c | 59 | bin/petrinet: ${COMMON} ./source/petrinet/petrinet.c |
45 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 60 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
46 | bin/statemate: ./source/extra.h ./source/statemate/statemate.c | 61 | bin/statemate: ${COMMON} ./source/statemate/statemate.c |
47 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 62 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
48 | bin/cjpeg_transupp: ./source/extra.h ./source/cjpeg_transupp/cjpeg_transupp.c | 63 | bin/cjpeg_transupp: ${COMMON} ./source/cjpeg_transupp/cjpeg_transupp.c |
49 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 64 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
50 | bin/mpeg2: ./source/extra.h ./source/mpeg2/mpeg2.c | 65 | bin/mpeg2: ${COMMON} ./source/mpeg2/mpeg2.c |
51 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 66 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
52 | bin/fmref: ./source/extra.h ./source/fmref/fmref.c ./source/fmref/wcclibm.c | 67 | bin/fmref: ${COMMON} ./source/fmref/fmref.c ./source/fmref/wcclibm.c |
53 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 68 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
54 | bin/audiobeam: ./source/extra.h ./source/audiobeam/audiobeam.c ./source/audiobeam/audiobeaminput.c ./source/audiobeam/audiobeamlibmalloc.c ./source/audiobeam/audiobeamlibm.c | 69 | bin/audiobeam: ${COMMON} ./source/audiobeam/audiobeam.c ./source/audiobeam/audiobeaminput.c ./source/audiobeam/audiobeamlibmalloc.c ./source/audiobeam/audiobeamlibm.c |
55 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 70 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
56 | bin/adpcm_dec: ./source/extra.h ./source/adpcm_dec/adpcm_dec.c | 71 | bin/adpcm_dec: ${COMMON} ./source/adpcm_dec/adpcm_dec.c |
57 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 72 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
73 | |||
diff --git a/all_pairs/source/adpcm_dec/adpcm_dec.c b/all_pairs/source/adpcm_dec/adpcm_dec.c index 04a5746..368e98d 100644 --- a/all_pairs/source/adpcm_dec/adpcm_dec.c +++ b/all_pairs/source/adpcm_dec/adpcm_dec.c | |||
@@ -35,7 +35,7 @@ | |||
35 | Forward declaration of functions | 35 | Forward declaration of functions |
36 | */ | 36 | */ |
37 | 37 | ||
38 | #include "../extra.h" | 38 | #include "extra.h" |
39 | 39 | ||
40 | void adpcm_dec_decode( int ); | 40 | void adpcm_dec_decode( int ); |
41 | int adpcm_dec_filtez( int *bpl, int *dlt ); | 41 | int adpcm_dec_filtez( int *bpl, int *dlt ); |
diff --git a/all_pairs/source/adpcm_enc/adpcm_enc.c b/all_pairs/source/adpcm_enc/adpcm_enc.c index 464768f..777aaf5 100644 --- a/all_pairs/source/adpcm_enc/adpcm_enc.c +++ b/all_pairs/source/adpcm_enc/adpcm_enc.c | |||
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | /* common sampling rate for sound cards on IBM/PC */ | 30 | /* common sampling rate for sound cards on IBM/PC */ |
31 | 31 | ||
32 | #include "../extra.h" | 32 | #include "extra.h" |
33 | #define SAMPLE_RATE 11025 | 33 | #define SAMPLE_RATE 11025 |
34 | 34 | ||
35 | #define PI 3141 | 35 | #define PI 3141 |
diff --git a/all_pairs/source/ammunition/ammunition.c b/all_pairs/source/ammunition/ammunition.c index 269f4c0..052520e 100644 --- a/all_pairs/source/ammunition/ammunition.c +++ b/all_pairs/source/ammunition/ammunition.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "../extra.h" | 27 | #include "extra.h" |
28 | #include "bits.h" | 28 | #include "bits.h" |
29 | #include "arithm.h" | 29 | #include "arithm.h" |
30 | #include "ammunition_stdlib.h" | 30 | #include "ammunition_stdlib.h" |
diff --git a/all_pairs/source/anagram/anagram.c b/all_pairs/source/anagram/anagram.c index b458fd2..5c1f29a 100644 --- a/all_pairs/source/anagram/anagram.c +++ b/all_pairs/source/anagram/anagram.c | |||
@@ -157,7 +157,7 @@ | |||
157 | steps to FindAnagram. | 157 | steps to FindAnagram. |
158 | */ | 158 | */ |
159 | 159 | ||
160 | #include "../extra.h" | 160 | #include "extra.h" |
161 | #include "anagram_ctype.h" | 161 | #include "anagram_ctype.h" |
162 | #include "anagram_stdlib.h" | 162 | #include "anagram_stdlib.h" |
163 | #include "anagram_strings.h" | 163 | #include "anagram_strings.h" |
diff --git a/all_pairs/source/audiobeam/audiobeam.c b/all_pairs/source/audiobeam/audiobeam.c index 208de80..50ebfff 100644 --- a/all_pairs/source/audiobeam/audiobeam.c +++ b/all_pairs/source/audiobeam/audiobeam.c | |||
@@ -23,7 +23,7 @@ | |||
23 | Include section | 23 | Include section |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "../extra.h" | 26 | #include "extra.h" |
27 | #include "audiobeamlibm.h" | 27 | #include "audiobeamlibm.h" |
28 | #include "audiobeamlibmalloc.h" | 28 | #include "audiobeamlibmalloc.h" |
29 | #include "audiobeam.h" | 29 | #include "audiobeam.h" |
diff --git a/all_pairs/source/cjpeg_transupp/cjpeg_transupp.c b/all_pairs/source/cjpeg_transupp/cjpeg_transupp.c index 3f48539..5ec7e5e 100644 --- a/all_pairs/source/cjpeg_transupp/cjpeg_transupp.c +++ b/all_pairs/source/cjpeg_transupp/cjpeg_transupp.c | |||
@@ -29,7 +29,7 @@ | |||
29 | Include section | 29 | Include section |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "../extra.h" | 32 | #include "extra.h" |
33 | #include "jpeglib.h" | 33 | #include "jpeglib.h" |
34 | 34 | ||
35 | 35 | ||
diff --git a/all_pairs/source/cjpeg_wrbmp/cjpeg_wrbmp.c b/all_pairs/source/cjpeg_wrbmp/cjpeg_wrbmp.c index 278725c..3c8d7ec 100644 --- a/all_pairs/source/cjpeg_wrbmp/cjpeg_wrbmp.c +++ b/all_pairs/source/cjpeg_wrbmp/cjpeg_wrbmp.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "../extra.h" | 27 | #include "extra.h" |
28 | #include "cdjpeg.h" | 28 | #include "cdjpeg.h" |
29 | 29 | ||
30 | #ifdef CJPEG_WRBMP_BMP_SUPPORTED | 30 | #ifdef CJPEG_WRBMP_BMP_SUPPORTED |
diff --git a/all_pairs/source/cleanupSemaphores.c b/all_pairs/source/cleanupSemaphores.c deleted file mode 100644 index dde2bb3..0000000 --- a/all_pairs/source/cleanupSemaphores.c +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #include <semaphore.h> | ||
2 | |||
3 | int main(){ | ||
4 | sem_unlink("/firstTacleSem"); | ||
5 | sem_unlink("/secondTacleSem"); | ||
6 | } | ||
diff --git a/all_pairs/source/dijkstra/dijkstra.c b/all_pairs/source/dijkstra/dijkstra.c index 1b6a52f..333fd43 100644 --- a/all_pairs/source/dijkstra/dijkstra.c +++ b/all_pairs/source/dijkstra/dijkstra.c | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include "../extra.h" | 20 | #include "extra.h" |
21 | #include "input.h" | 21 | #include "input.h" |
22 | 22 | ||
23 | /* | 23 | /* |
diff --git a/all_pairs/source/empty.c b/all_pairs/source/empty.c index c7c5f5d..6681ba7 100644 --- a/all_pairs/source/empty.c +++ b/all_pairs/source/empty.c | |||
@@ -1,4 +1,4 @@ | |||
1 | #include "../extra.h" | 1 | #include "extra.h" |
2 | 2 | ||
3 | int main(int argc, char **argv) | 3 | int main(int argc, char **argv) |
4 | { | 4 | { |
diff --git a/all_pairs/source/epic/epic.c b/all_pairs/source/epic/epic.c index e258a4a..a1e344c 100644 --- a/all_pairs/source/epic/epic.c +++ b/all_pairs/source/epic/epic.c | |||
@@ -35,7 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | 37 | ||
38 | #include "../extra.h" | 38 | #include "extra.h" |
39 | #include "epic.h" | 39 | #include "epic.h" |
40 | 40 | ||
41 | #define X_SIZE 64 | 41 | #define X_SIZE 64 |
diff --git a/all_pairs/source/extra.h b/all_pairs/source/extra.h deleted file mode 100644 index 0681250..0000000 --- a/all_pairs/source/extra.h +++ /dev/null | |||
@@ -1,211 +0,0 @@ | |||
1 | /** | ||
2 | * Copyright 2019 Sims Hill Osborne and Joshua Bakita | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
5 | * of this software and associated documentation files (the "Software"), to deal | ||
6 | * in the Software without restriction, including without limitation the rights | ||
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
8 | * copies of the Software, and to permit persons to whom the Software is | ||
9 | * furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
20 | * SOFTWARE. | ||
21 | **/ | ||
22 | #define _GNU_SOURCE | ||
23 | #include <fcntl.h> | ||
24 | #include <limits.h> | ||
25 | #include <semaphore.h> | ||
26 | #include <signal.h> | ||
27 | #include <stdlib.h> | ||
28 | #include <stdio.h> | ||
29 | #include <string.h> | ||
30 | #include <sys/mman.h> | ||
31 | #include <sys/stat.h> | ||
32 | #include <time.h> | ||
33 | #include <unistd.h> | ||
34 | #include <sched.h> | ||
35 | |||
36 | // This is only visible if _GNU_SOURCE is defined, and that define does not | ||
37 | // come along to places where this file is included. Address this by manually | ||
38 | // forcing it into the global namespace. | ||
39 | extern int sched_getcpu(); | ||
40 | |||
41 | // Benchmarks use SET_UP, START_LOOP, STOP_LOOP, and WRITE_TO_FILE | ||
42 | // These are macros so that we can declare and maintain additional state inside | ||
43 | // the benchmark. | ||
44 | #define SET_UP if (argc != 8) {\ | ||
45 | printf("Usage: %s <name> <runs> <my core> <other core> <other program> <runID> <lockID>", argv[0]);\ | ||
46 | exit(1);\ | ||
47 | }\ | ||
48 | char * thisProgram = argv[1];\ | ||
49 | int maxJobs = atoi(argv[2]);\ | ||
50 | unsigned int thisCore = atoi(argv[3]);\ | ||
51 | unsigned int otherCore = atoi(argv[4]);\ | ||
52 | thisCore = sched_getcpu();\ | ||
53 | char * otherProgram = argv[5];\ | ||
54 | char * runID = argv[6];\ | ||
55 | int lockID = atoi(argv[7]);\ | ||
56 | struct timespec _start, _end;\ | ||
57 | int jobsComplete;\ | ||
58 | int jobs_complete = -1;\ | ||
59 | long * startS = malloc(sizeof(long) *maxJobs);\ | ||
60 | long * startN = malloc(sizeof(long) *maxJobs);\ | ||
61 | long * endS = malloc(sizeof(long) *maxJobs);\ | ||
62 | long * endN = malloc(sizeof(long) *maxJobs);\ | ||
63 | char * bigArray;\ | ||
64 | char fileName[strlen(runID) + 5];\ | ||
65 | strcpy(fileName, runID);\ | ||
66 | strcat(fileName, ".txt");\ | ||
67 | mlockall(MCL_CURRENT || MCL_FUTURE);\ | ||
68 | sem_t *firstSem=sem_open("/firstTacleSem", O_CREAT, 644, 0);\ | ||
69 | if (firstSem == SEM_FAILED) {\ | ||
70 | perror("Error opening/creating first semaphore");\ | ||
71 | exit(1);\ | ||
72 | }\ | ||
73 | sem_t *secondSem=sem_open("/secondTacleSem", O_CREAT, 644, 0);\ | ||
74 | if (secondSem == SEM_FAILED) {\ | ||
75 | perror("Error opening/creating second semaphore");\ | ||
76 | exit(1);\ | ||
77 | }\ | ||
78 | int barrier_file = shm_open("/TacleBarrier", O_CREAT | O_RDWR, 644);\ | ||
79 | if (barrier_file == -1) {\ | ||
80 | perror("Error creating shared memory");\ | ||
81 | exit(1);\ | ||
82 | }\ | ||
83 | /* This sets our shared file to be one byte of '\0'*/ \ | ||
84 | if (ftruncate(barrier_file, 1) == -1) {\ | ||
85 | perror("Error setting size of shared memory");\ | ||
86 | exit(1);\ | ||
87 | }\ | ||
88 | char * barrier = mmap(NULL, 1, PROT_WRITE, MAP_SHARED, barrier_file, 0);\ | ||
89 | if (barrier == MAP_FAILED) {\ | ||
90 | perror("Error mapping shared memory");\ | ||
91 | exit(1);\ | ||
92 | }\ | ||
93 | int val; | ||
94 | |||
95 | #define SAVE_RESULTS \ | ||
96 | if(jobs_complete >= maxJobs) {\ | ||
97 | fprintf(stderr, "Max jobs setting too small! Trying to record job #%d when we only have space for %d jobs. Exiting...\n", jobs_complete, maxJobs);\ | ||
98 | exit(1);\ | ||
99 | }\ | ||
100 | if (jobs_complete > -1){\ | ||
101 | startS[jobs_complete]=_start.tv_sec;\ | ||
102 | startN[jobs_complete]=_start.tv_nsec;\ | ||
103 | endS[jobs_complete]=_end.tv_sec;\ | ||
104 | endN[jobs_complete]=_end.tv_nsec;\ | ||
105 | } | ||
106 | |||
107 | #define WRITE_TO_FILE {\ | ||
108 | munlockall();\ | ||
109 | FILE *fp = fopen(fileName, "a");\ | ||
110 | if (fp == NULL) {\ | ||
111 | perror("Error opening file. \n");\ | ||
112 | exit(1);\ | ||
113 | }\ | ||
114 | for(int i = 0; i <= jobs_complete; i++){\ | ||
115 | fprintf(fp, "%s %s %u %u %d %ld %ld %ld %ld %s %d \n",\ | ||
116 | thisProgram, otherProgram, thisCore, otherCore, maxJobs,\ | ||
117 | startS[i], startN[i], endS[i], endN[i],\ | ||
118 | runID, i);\ | ||
119 | }\ | ||
120 | fclose(fp);\ | ||
121 | /* Clean up the barrier synchronization shared memory */\ | ||
122 | munmap(barrier, 1);\ | ||
123 | shm_unlink("/TacleBarrier");\ | ||
124 | free(startS);\ | ||
125 | free(startN);\ | ||
126 | free(endS);\ | ||
127 | free(endN);\ | ||
128 | } | ||
129 | |||
130 | // Call the wbinvld instruction (it's in a kernel module due to it being ring-0) | ||
131 | #define FLUSH_CACHES FILE *fp = fopen("/proc/wbinvd", "r");\ | ||
132 | if (fp == NULL) {\ | ||
133 | perror("Cache flush module interface cannot be opened");\ | ||
134 | exit(1);\ | ||
135 | }\ | ||
136 | char dummy;\ | ||
137 | if (fread(&dummy, 1, 1, fp) == 0) {\ | ||
138 | perror("Unable to access cache flush module interface");\ | ||
139 | exit(1);\ | ||
140 | }\ | ||
141 | fclose(fp); | ||
142 | |||
143 | // These timers should just be aliases to the hardware counters w/ some small adjustments | ||
144 | #define START_TIMER clock_gettime(CLOCK_MONOTONIC, &_start); | ||
145 | #define STOP_TIMER clock_gettime(CLOCK_MONOTONIC, &_end); | ||
146 | |||
147 | //check value of sem | ||
148 | //if sem=0, unlock | ||
149 | //if sem=1, spin | ||
150 | |||
151 | #define SLEEP nanosleep((const struct timespec[]){{0, 1000000}}, NULL); | ||
152 | |||
153 | #define FIRST_UNLOCK if (lockID == 1) {\ | ||
154 | if (sem_post(secondSem) != 0) {\ | ||
155 | perror("Unable to unlock second semaphore");\ | ||
156 | exit(1);\ | ||
157 | }\ | ||
158 | } \ | ||
159 | else {\ | ||
160 | if (sem_post(firstSem) != 0) {\ | ||
161 | perror("Unable to unlock first semaphore");\ | ||
162 | exit(1);\ | ||
163 | }\ | ||
164 | } \ | ||
165 | |||
166 | #define FIRST_LOCK if (lockID == 1) {\ | ||
167 | if (sem_wait(firstSem) != 0) {\ | ||
168 | perror("Unable to wait on first semaphore");\ | ||
169 | exit(1);\ | ||
170 | }\ | ||
171 | }\ | ||
172 | else {\ | ||
173 | if (sem_wait(secondSem) != 0) {\ | ||
174 | perror("Unable to wait on second semaphore");\ | ||
175 | exit(1);\ | ||
176 | }\ | ||
177 | } | ||
178 | |||
179 | |||
180 | #define SECOND_UNLOCK if (lockID==1){sem_post(fourthSem) ; }\ | ||
181 | else {sem_post(thirdSem) ; } | ||
182 | |||
183 | #define SECOND_LOCK if (lockID==1){sem_wait(thirdSem); }\ | ||
184 | else {sem_wait(fourthSem); } | ||
185 | |||
186 | #define BARRIER_SYNC if (__sync_bool_compare_and_swap(barrier, 0, 1)) {\ | ||
187 | while (!__sync_bool_compare_and_swap(barrier, 0, 0)) {};\ | ||
188 | }\ | ||
189 | else {\ | ||
190 | __sync_bool_compare_and_swap(barrier, 1, 0);\ | ||
191 | } | ||
192 | |||
193 | #define START_LOOP FIRST_UNLOCK FIRST_LOCK sched_yield(); FLUSH_CACHES BARRIER_SYNC START_TIMER | ||
194 | #define STOP_LOOP STOP_TIMER jobs_complete++; SAVE_RESULTS | ||
195 | |||
196 | |||
197 | /* | ||
198 | Intended structure | ||
199 | |||
200 | main | ||
201 | SET_UP | ||
202 | notice that STOP LOOP negates the ++ if outout=0 | ||
203 | for (jobsComplete=0; jobsComplete<maxJobs; jobsComplete++){ | ||
204 | START_LOOP | ||
205 | tacleInit(); | ||
206 | tacleMain(); | ||
207 | STOP_LOOP | ||
208 | } | ||
209 | WRITE_TO_FILE | ||
210 | tacleReturn | ||
211 | */ | ||
diff --git a/all_pairs/source/fmref/fmref.c b/all_pairs/source/fmref/fmref.c index bcc7ce6..e4c9aaa 100644 --- a/all_pairs/source/fmref/fmref.c +++ b/all_pairs/source/fmref/fmref.c | |||
@@ -5,7 +5,7 @@ | |||
5 | */ | 5 | */ |
6 | 6 | ||
7 | 7 | ||
8 | #include "../extra.h" | 8 | #include "extra.h" |
9 | #include "wcclibm.h" | 9 | #include "wcclibm.h" |
10 | #ifndef M_PI | 10 | #ifndef M_PI |
11 | #define M_PI 3.1415926535897932384626433832795 | 11 | #define M_PI 3.1415926535897932384626433832795 |
diff --git a/all_pairs/source/g723_enc/g723_enc.c b/all_pairs/source/g723_enc/g723_enc.c index 331c821..209e3ce 100644 --- a/all_pairs/source/g723_enc/g723_enc.c +++ b/all_pairs/source/g723_enc/g723_enc.c | |||
@@ -31,7 +31,7 @@ | |||
31 | included in this Recommendation. | 31 | included in this Recommendation. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include "../extra.h" | 34 | #include "extra.h" |
35 | struct g723_enc_state_t { | 35 | struct g723_enc_state_t { |
36 | long yl; /* Locked or steady state step size multiplier. */ | 36 | long yl; /* Locked or steady state step size multiplier. */ |
37 | short yu; /* Unlocked or non-steady state step size multiplier. */ | 37 | short yu; /* Unlocked or non-steady state step size multiplier. */ |
diff --git a/all_pairs/source/gsm_dec/gsm_dec.c b/all_pairs/source/gsm_dec/gsm_dec.c index 06d24d5..ba9a9e9 100644 --- a/all_pairs/source/gsm_dec/gsm_dec.c +++ b/all_pairs/source/gsm_dec/gsm_dec.c | |||
@@ -21,7 +21,7 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | 23 | ||
24 | #include "../extra.h" | 24 | #include "extra.h" |
25 | #include "gsm.h" | 25 | #include "gsm.h" |
26 | #include "add.h" | 26 | #include "add.h" |
27 | #include "data.h" | 27 | #include "data.h" |
diff --git a/all_pairs/source/gsm_enc/gsm_enc.c b/all_pairs/source/gsm_enc/gsm_enc.c index 3f051ec..e8154bb 100644 --- a/all_pairs/source/gsm_enc/gsm_enc.c +++ b/all_pairs/source/gsm_enc/gsm_enc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. | 5 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include "../extra.h" | 8 | #include "extra.h" |
9 | #include "private.h" | 9 | #include "private.h" |
10 | 10 | ||
11 | /* | 11 | /* |
diff --git a/all_pairs/source/h264_dec/h264_dec.c b/all_pairs/source/h264_dec/h264_dec.c index 1fed68b..e74bec9 100644 --- a/all_pairs/source/h264_dec/h264_dec.c +++ b/all_pairs/source/h264_dec/h264_dec.c | |||
@@ -25,7 +25,7 @@ | |||
25 | Include section | 25 | Include section |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include "../extra.h" | 28 | #include "extra.h" |
29 | #include "h264_dec.h" | 29 | #include "h264_dec.h" |
30 | 30 | ||
31 | 31 | ||
diff --git a/all_pairs/source/huff_dec/huff_dec.c b/all_pairs/source/huff_dec/huff_dec.c index b83b99d..58b40d3 100644 --- a/all_pairs/source/huff_dec/huff_dec.c +++ b/all_pairs/source/huff_dec/huff_dec.c | |||
@@ -49,7 +49,7 @@ new schemes (this item is not a must) | |||
49 | */ | 49 | */ |
50 | 50 | ||
51 | 51 | ||
52 | #include "../extra.h" | 52 | #include "extra.h" |
53 | typedef struct s_tree { | 53 | typedef struct s_tree { |
54 | unsigned int byte; /* A byte has to be coded as an unsigned integer to | 54 | unsigned int byte; /* A byte has to be coded as an unsigned integer to |
55 | allow a node to have a value over 255 */ | 55 | allow a node to have a value over 255 */ |
diff --git a/all_pairs/source/huff_enc/huff_enc.c b/all_pairs/source/huff_enc/huff_enc.c index 133fe95..0d74916 100644 --- a/all_pairs/source/huff_enc/huff_enc.c +++ b/all_pairs/source/huff_enc/huff_enc.c | |||
@@ -50,7 +50,7 @@ new schemes (this item is not a must) | |||
50 | */ | 50 | */ |
51 | 51 | ||
52 | 52 | ||
53 | #include "../extra.h" | 53 | #include "extra.h" |
54 | typedef struct huff_enc_s_tree { | 54 | typedef struct huff_enc_s_tree { |
55 | unsigned int byte; /* A byte has to be coded as an unsigned integer to | 55 | unsigned int byte; /* A byte has to be coded as an unsigned integer to |
56 | allow a node to have a value over 255 */ | 56 | allow a node to have a value over 255 */ |
diff --git a/all_pairs/source/mpeg2/mpeg2.c b/all_pairs/source/mpeg2/mpeg2.c index a810744..0567225 100644 --- a/all_pairs/source/mpeg2/mpeg2.c +++ b/all_pairs/source/mpeg2/mpeg2.c | |||
@@ -48,7 +48,7 @@ | |||
48 | /* | 48 | /* |
49 | Forward declaration of data types | 49 | Forward declaration of data types |
50 | */ | 50 | */ |
51 | #include "../extra.h" | 51 | #include "extra.h" |
52 | struct mbinfo; | 52 | struct mbinfo; |
53 | 53 | ||
54 | 54 | ||
diff --git a/all_pairs/source/ndes/ndes.c b/all_pairs/source/ndes/ndes.c index b0f494c..f169c62 100644 --- a/all_pairs/source/ndes/ndes.c +++ b/all_pairs/source/ndes/ndes.c | |||
@@ -17,7 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | /* A read from this address will result in an known value of 1 */ | 19 | /* A read from this address will result in an known value of 1 */ |
20 | #include "../extra.h" | 20 | #include "extra.h" |
21 | #define KNOWN_VALUE 1 | 21 | #define KNOWN_VALUE 1 |
22 | #define NDES_WORSTCASE 1 | 22 | #define NDES_WORSTCASE 1 |
23 | /* | 23 | /* |
diff --git a/all_pairs/source/petrinet/petrinet.c b/all_pairs/source/petrinet/petrinet.c index cabb40d..6ef3392 100644 --- a/all_pairs/source/petrinet/petrinet.c +++ b/all_pairs/source/petrinet/petrinet.c | |||
@@ -25,7 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | 27 | ||
28 | #include "../extra.h" | 28 | #include "extra.h" |
29 | 29 | ||
30 | #ifdef PROFILING | 30 | #ifdef PROFILING |
31 | #include <stdio.h> | 31 | #include <stdio.h> |
diff --git a/all_pairs/source/rijndael_dec/rijndael_dec.c b/all_pairs/source/rijndael_dec/rijndael_dec.c index 93bb424..61db767 100644 --- a/all_pairs/source/rijndael_dec/rijndael_dec.c +++ b/all_pairs/source/rijndael_dec/rijndael_dec.c | |||
@@ -38,7 +38,7 @@ | |||
38 | ----------------------------------------------------------------------- | 38 | ----------------------------------------------------------------------- |
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include "../extra.h" | 41 | #include "extra.h" |
42 | #include "aes.h" | 42 | #include "aes.h" |
43 | #include "rijndael_dec_libc.h" | 43 | #include "rijndael_dec_libc.h" |
44 | 44 | ||
diff --git a/all_pairs/source/rijndael_enc/rijndael_enc.c b/all_pairs/source/rijndael_enc/rijndael_enc.c index 0c10353..6c85eee 100644 --- a/all_pairs/source/rijndael_enc/rijndael_enc.c +++ b/all_pairs/source/rijndael_enc/rijndael_enc.c | |||
@@ -38,7 +38,7 @@ | |||
38 | ----------------------------------------------------------------------- | 38 | ----------------------------------------------------------------------- |
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include "../extra.h" | 41 | #include "extra.h" |
42 | #include "aes.h" | 42 | #include "aes.h" |
43 | #include "rijndael_enc_libc.h" | 43 | #include "rijndael_enc_libc.h" |
44 | 44 | ||
diff --git a/all_pairs/source/statemate/statemate.c b/all_pairs/source/statemate/statemate.c index 00491e5..888d0fa 100644 --- a/all_pairs/source/statemate/statemate.c +++ b/all_pairs/source/statemate/statemate.c | |||
@@ -27,7 +27,7 @@ | |||
27 | Macro definitions | 27 | Macro definitions |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "../extra.h" | 30 | #include "extra.h" |
31 | 31 | ||
32 | #define SYS_bit_get(a,b) (a)[(b)] | 32 | #define SYS_bit_get(a,b) (a)[(b)] |
33 | #define SYS_bit_clr(a,b) (a)[(b)] = 0 | 33 | #define SYS_bit_clr(a,b) (a)[(b)] = 0 |
diff --git a/all_pairs/source/susan/susan.c b/all_pairs/source/susan/susan.c index 4bc4cb8..dc27fb1 100644 --- a/all_pairs/source/susan/susan.c +++ b/all_pairs/source/susan/susan.c | |||
@@ -269,7 +269,7 @@ | |||
269 | 269 | ||
270 | \**********************************************************************/ | 270 | \**********************************************************************/ |
271 | 271 | ||
272 | #include "../extra.h" | 272 | #include "extra.h" |
273 | #include "wcclibm.h" | 273 | #include "wcclibm.h" |
274 | #include "wccfile.h" | 274 | #include "wccfile.h" |
275 | #include "wccmalloc.h" | 275 | #include "wccmalloc.h" |
diff --git a/baseline/Makefile b/baseline/Makefile index ef39b7d..40b57f4 100644 --- a/baseline/Makefile +++ b/baseline/Makefile | |||
@@ -1,25 +1,28 @@ | |||
1 | LIBLITMUS ?= /media/speedy/litmus/liblitmus | 1 | LIBLITMUS ?= /media/speedy/litmus/liblitmus |
2 | CC ?= gcc | 2 | CC ?= gcc |
3 | CFLAGS = -pthread -O2 | 3 | CFLAGS = -pthread -O2 -I.. |
4 | LDFLAGS = -lrt | 4 | LDFLAGS = -lrt |
5 | COMMON = ./source/extra.h | 5 | COMMON = ../extra.h |
6 | 6 | ||
7 | # Handle cases where we're also profiling with the MMDC on the i.MX6Q | 7 | # Handle cases where we're also profiling with the MMDC on the i.MX6Q |
8 | ifneq ($(shell grep "define MMDC 1" source/extra.h),) | 8 | ifneq ($(shell grep "define MMDC 1" ../extra.h),) |
9 | COMMON += /media/speedy/litmus/tools/mmdc/mmdc.c | 9 | COMMON += /media/speedy/litmus/tools/mmdc/mmdc.c |
10 | endif | 10 | endif |
11 | 11 | ||
12 | # Include all the LITMUS^RT headers if we're using it | 12 | # Include all the LITMUS^RT headers if we're using it |
13 | ifneq ($(shell grep "define LITMUS 1" source/extra.h),) | 13 | ifneq ($(shell grep "define LITMUS 1" ../extra.h),) |
14 | CFLAGS += -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include | 14 | CFLAGS += -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include |
15 | LDFLAGS += -L${LIBLITMUS} -llitmus | 15 | LDFLAGS += -L${LIBLITMUS} -llitmus |
16 | endif | 16 | endif |
17 | 17 | ||
18 | all: bin/cjpeg_wrbmp bin/huff_enc bin/gsm_enc bin/dijkstra bin/h264_dec bin/susan bin/adpcm_enc bin/rijndael_dec bin/huff_dec bin/rijndael_enc bin/gsm_dec bin/anagram bin/epic bin/ammunition bin/g723_enc bin/ndes bin/petrinet bin/statemate bin/cjpeg_transupp bin/mpeg2 bin/fmref bin/audiobeam bin/adpcm_dec | 18 | all: bin/cjpeg_wrbmp bin/huff_enc bin/gsm_enc bin/dijkstra bin/h264_dec bin/susan bin/adpcm_enc bin/rijndael_dec bin/huff_dec bin/rijndael_enc bin/gsm_dec bin/anagram bin/epic bin/ammunition bin/g723_enc bin/ndes bin/petrinet bin/statemate bin/cjpeg_transupp bin/mpeg2 bin/fmref bin/audiobeam bin/adpcm_dec |
19 | 19 | ||
20 | debug: all | ||
21 | debug: CFLAGS += -ggdb3 | ||
22 | |||
20 | .PHONY: clean | 23 | .PHONY: clean |
21 | clean: | 24 | clean: |
22 | rm bin/cjpeg_wrbmp bin/huff_enc bin/gsm_enc bin/dijkstra bin/h264_dec bin/susan bin/adpcm_enc bin/rijndael_dec bin/huff_dec bin/rijndael_enc bin/gsm_dec bin/anagram bin/epic bin/ammunition bin/g723_enc bin/ndes bin/petrinet bin/statemate bin/cjpeg_transupp bin/mpeg2 bin/fmref bin/audiobeam bin/adpcm_dec | 25 | rm -f bin/cjpeg_wrbmp bin/huff_enc bin/gsm_enc bin/dijkstra bin/h264_dec bin/susan bin/adpcm_enc bin/rijndael_dec bin/huff_dec bin/rijndael_enc bin/gsm_dec bin/anagram bin/epic bin/ammunition bin/g723_enc bin/ndes bin/petrinet bin/statemate bin/cjpeg_transupp bin/mpeg2 bin/fmref bin/audiobeam bin/adpcm_dec |
23 | 26 | ||
24 | bin/cjpeg_wrbmp: ${COMMON} ./source/cjpeg_wrbmp/cjpeg_wrbmp.c ./source/cjpeg_wrbmp/input.c | 27 | bin/cjpeg_wrbmp: ${COMMON} ./source/cjpeg_wrbmp/cjpeg_wrbmp.c ./source/cjpeg_wrbmp/input.c |
25 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 28 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
diff --git a/baseline/source/adpcm_dec/adpcm_dec.c b/baseline/source/adpcm_dec/adpcm_dec.c index 04a5746..368e98d 100644 --- a/baseline/source/adpcm_dec/adpcm_dec.c +++ b/baseline/source/adpcm_dec/adpcm_dec.c | |||
@@ -35,7 +35,7 @@ | |||
35 | Forward declaration of functions | 35 | Forward declaration of functions |
36 | */ | 36 | */ |
37 | 37 | ||
38 | #include "../extra.h" | 38 | #include "extra.h" |
39 | 39 | ||
40 | void adpcm_dec_decode( int ); | 40 | void adpcm_dec_decode( int ); |
41 | int adpcm_dec_filtez( int *bpl, int *dlt ); | 41 | int adpcm_dec_filtez( int *bpl, int *dlt ); |
diff --git a/baseline/source/adpcm_enc/adpcm_enc.c b/baseline/source/adpcm_enc/adpcm_enc.c index 464768f..777aaf5 100644 --- a/baseline/source/adpcm_enc/adpcm_enc.c +++ b/baseline/source/adpcm_enc/adpcm_enc.c | |||
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | /* common sampling rate for sound cards on IBM/PC */ | 30 | /* common sampling rate for sound cards on IBM/PC */ |
31 | 31 | ||
32 | #include "../extra.h" | 32 | #include "extra.h" |
33 | #define SAMPLE_RATE 11025 | 33 | #define SAMPLE_RATE 11025 |
34 | 34 | ||
35 | #define PI 3141 | 35 | #define PI 3141 |
diff --git a/baseline/source/ammunition/ammunition.c b/baseline/source/ammunition/ammunition.c index 269f4c0..052520e 100644 --- a/baseline/source/ammunition/ammunition.c +++ b/baseline/source/ammunition/ammunition.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "../extra.h" | 27 | #include "extra.h" |
28 | #include "bits.h" | 28 | #include "bits.h" |
29 | #include "arithm.h" | 29 | #include "arithm.h" |
30 | #include "ammunition_stdlib.h" | 30 | #include "ammunition_stdlib.h" |
diff --git a/baseline/source/anagram/anagram.c b/baseline/source/anagram/anagram.c index b458fd2..5c1f29a 100644 --- a/baseline/source/anagram/anagram.c +++ b/baseline/source/anagram/anagram.c | |||
@@ -157,7 +157,7 @@ | |||
157 | steps to FindAnagram. | 157 | steps to FindAnagram. |
158 | */ | 158 | */ |
159 | 159 | ||
160 | #include "../extra.h" | 160 | #include "extra.h" |
161 | #include "anagram_ctype.h" | 161 | #include "anagram_ctype.h" |
162 | #include "anagram_stdlib.h" | 162 | #include "anagram_stdlib.h" |
163 | #include "anagram_strings.h" | 163 | #include "anagram_strings.h" |
diff --git a/baseline/source/audiobeam/audiobeam.c b/baseline/source/audiobeam/audiobeam.c index 208de80..50ebfff 100644 --- a/baseline/source/audiobeam/audiobeam.c +++ b/baseline/source/audiobeam/audiobeam.c | |||
@@ -23,7 +23,7 @@ | |||
23 | Include section | 23 | Include section |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "../extra.h" | 26 | #include "extra.h" |
27 | #include "audiobeamlibm.h" | 27 | #include "audiobeamlibm.h" |
28 | #include "audiobeamlibmalloc.h" | 28 | #include "audiobeamlibmalloc.h" |
29 | #include "audiobeam.h" | 29 | #include "audiobeam.h" |
diff --git a/baseline/source/cjpeg_transupp/cjpeg_transupp.c b/baseline/source/cjpeg_transupp/cjpeg_transupp.c index 3f48539..5ec7e5e 100644 --- a/baseline/source/cjpeg_transupp/cjpeg_transupp.c +++ b/baseline/source/cjpeg_transupp/cjpeg_transupp.c | |||
@@ -29,7 +29,7 @@ | |||
29 | Include section | 29 | Include section |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "../extra.h" | 32 | #include "extra.h" |
33 | #include "jpeglib.h" | 33 | #include "jpeglib.h" |
34 | 34 | ||
35 | 35 | ||
diff --git a/baseline/source/cjpeg_wrbmp/cjpeg_wrbmp.c b/baseline/source/cjpeg_wrbmp/cjpeg_wrbmp.c index 278725c..3c8d7ec 100644 --- a/baseline/source/cjpeg_wrbmp/cjpeg_wrbmp.c +++ b/baseline/source/cjpeg_wrbmp/cjpeg_wrbmp.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "../extra.h" | 27 | #include "extra.h" |
28 | #include "cdjpeg.h" | 28 | #include "cdjpeg.h" |
29 | 29 | ||
30 | #ifdef CJPEG_WRBMP_BMP_SUPPORTED | 30 | #ifdef CJPEG_WRBMP_BMP_SUPPORTED |
diff --git a/baseline/source/dijkstra/dijkstra.c b/baseline/source/dijkstra/dijkstra.c index 1b6a52f..333fd43 100644 --- a/baseline/source/dijkstra/dijkstra.c +++ b/baseline/source/dijkstra/dijkstra.c | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include "../extra.h" | 20 | #include "extra.h" |
21 | #include "input.h" | 21 | #include "input.h" |
22 | 22 | ||
23 | /* | 23 | /* |
diff --git a/baseline/source/epic/epic.c b/baseline/source/epic/epic.c index e258a4a..a1e344c 100644 --- a/baseline/source/epic/epic.c +++ b/baseline/source/epic/epic.c | |||
@@ -35,7 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | 37 | ||
38 | #include "../extra.h" | 38 | #include "extra.h" |
39 | #include "epic.h" | 39 | #include "epic.h" |
40 | 40 | ||
41 | #define X_SIZE 64 | 41 | #define X_SIZE 64 |
diff --git a/baseline/source/fmref/fmref.c b/baseline/source/fmref/fmref.c index bcc7ce6..e4c9aaa 100644 --- a/baseline/source/fmref/fmref.c +++ b/baseline/source/fmref/fmref.c | |||
@@ -5,7 +5,7 @@ | |||
5 | */ | 5 | */ |
6 | 6 | ||
7 | 7 | ||
8 | #include "../extra.h" | 8 | #include "extra.h" |
9 | #include "wcclibm.h" | 9 | #include "wcclibm.h" |
10 | #ifndef M_PI | 10 | #ifndef M_PI |
11 | #define M_PI 3.1415926535897932384626433832795 | 11 | #define M_PI 3.1415926535897932384626433832795 |
diff --git a/baseline/source/g723_enc/g723_enc.c b/baseline/source/g723_enc/g723_enc.c index 331c821..209e3ce 100644 --- a/baseline/source/g723_enc/g723_enc.c +++ b/baseline/source/g723_enc/g723_enc.c | |||
@@ -31,7 +31,7 @@ | |||
31 | included in this Recommendation. | 31 | included in this Recommendation. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include "../extra.h" | 34 | #include "extra.h" |
35 | struct g723_enc_state_t { | 35 | struct g723_enc_state_t { |
36 | long yl; /* Locked or steady state step size multiplier. */ | 36 | long yl; /* Locked or steady state step size multiplier. */ |
37 | short yu; /* Unlocked or non-steady state step size multiplier. */ | 37 | short yu; /* Unlocked or non-steady state step size multiplier. */ |
diff --git a/baseline/source/gsm_dec/gsm_dec.c b/baseline/source/gsm_dec/gsm_dec.c index 06d24d5..ba9a9e9 100644 --- a/baseline/source/gsm_dec/gsm_dec.c +++ b/baseline/source/gsm_dec/gsm_dec.c | |||
@@ -21,7 +21,7 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | 23 | ||
24 | #include "../extra.h" | 24 | #include "extra.h" |
25 | #include "gsm.h" | 25 | #include "gsm.h" |
26 | #include "add.h" | 26 | #include "add.h" |
27 | #include "data.h" | 27 | #include "data.h" |
diff --git a/baseline/source/gsm_enc/gsm_enc.c b/baseline/source/gsm_enc/gsm_enc.c index 3f051ec..e8154bb 100644 --- a/baseline/source/gsm_enc/gsm_enc.c +++ b/baseline/source/gsm_enc/gsm_enc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. | 5 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include "../extra.h" | 8 | #include "extra.h" |
9 | #include "private.h" | 9 | #include "private.h" |
10 | 10 | ||
11 | /* | 11 | /* |
diff --git a/baseline/source/h264_dec/h264_dec.c b/baseline/source/h264_dec/h264_dec.c index 1fed68b..e74bec9 100644 --- a/baseline/source/h264_dec/h264_dec.c +++ b/baseline/source/h264_dec/h264_dec.c | |||
@@ -25,7 +25,7 @@ | |||
25 | Include section | 25 | Include section |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include "../extra.h" | 28 | #include "extra.h" |
29 | #include "h264_dec.h" | 29 | #include "h264_dec.h" |
30 | 30 | ||
31 | 31 | ||
diff --git a/baseline/source/huff_dec/huff_dec.c b/baseline/source/huff_dec/huff_dec.c index b83b99d..58b40d3 100644 --- a/baseline/source/huff_dec/huff_dec.c +++ b/baseline/source/huff_dec/huff_dec.c | |||
@@ -49,7 +49,7 @@ new schemes (this item is not a must) | |||
49 | */ | 49 | */ |
50 | 50 | ||
51 | 51 | ||
52 | #include "../extra.h" | 52 | #include "extra.h" |
53 | typedef struct s_tree { | 53 | typedef struct s_tree { |
54 | unsigned int byte; /* A byte has to be coded as an unsigned integer to | 54 | unsigned int byte; /* A byte has to be coded as an unsigned integer to |
55 | allow a node to have a value over 255 */ | 55 | allow a node to have a value over 255 */ |
diff --git a/baseline/source/huff_enc/huff_enc.c b/baseline/source/huff_enc/huff_enc.c index 133fe95..0d74916 100644 --- a/baseline/source/huff_enc/huff_enc.c +++ b/baseline/source/huff_enc/huff_enc.c | |||
@@ -50,7 +50,7 @@ new schemes (this item is not a must) | |||
50 | */ | 50 | */ |
51 | 51 | ||
52 | 52 | ||
53 | #include "../extra.h" | 53 | #include "extra.h" |
54 | typedef struct huff_enc_s_tree { | 54 | typedef struct huff_enc_s_tree { |
55 | unsigned int byte; /* A byte has to be coded as an unsigned integer to | 55 | unsigned int byte; /* A byte has to be coded as an unsigned integer to |
56 | allow a node to have a value over 255 */ | 56 | allow a node to have a value over 255 */ |
diff --git a/baseline/source/litmusStuff.h b/baseline/source/litmusStuff.h deleted file mode 100644 index dca2360..0000000 --- a/baseline/source/litmusStuff.h +++ /dev/null | |||
@@ -1,80 +0,0 @@ | |||
1 | #include <time.h> | ||
2 | #include <sys/mman.h> | ||
3 | #include <stdlib.h> | ||
4 | #include <stdio.h> | ||
5 | #include <string.h> | ||
6 | #include <signal.h> | ||
7 | #include <limits.h> | ||
8 | #include <../litmus.h> | ||
9 | |||
10 | #define L3_CACHE_SIZE (11264*1024) | ||
11 | |||
12 | #define SAVE_RESULTS if(jobsComplete>-1) progTime[jobsComplete]=(end.tv_nsec-start.tv_nsec)+(1000000000*(end.tv_sec-start.tv_sec)); | ||
13 | |||
14 | |||
15 | #define SET_UP char *thisProgram=argv[1];\ | ||
16 | int maxJobs=atoi(argv[2]);\ | ||
17 | char *thisCore=argv[3];\ | ||
18 | char *otherCore=argv[4];\ | ||
19 | char *otherProgram=argv[5];\ | ||
20 | char *runID=argv[6];\ | ||
21 | int output=atoi(argv[7]);\ | ||
22 | struct timespec start, end;\ | ||
23 | int jobsComplete;\ | ||
24 | long progTime[maxJobs*output];\ | ||
25 | char fileName[50];\ | ||
26 | char *bigArray;\ | ||
27 | strcpy(fileName, runID);\ | ||
28 | strcat(fileName, ".txt");\ | ||
29 | mlockall(MCL_CURRENT || MCL_FUTURE); | ||
30 | |||
31 | #define WRITE_TO_FILE if (output){\ | ||
32 | munlockall();\ | ||
33 | FILE *fp=fopen(fileName, "a");\ | ||
34 | for(jobsComplete=0; jobsComplete<maxJobs; jobsComplete++){\ | ||
35 | fprintf(fp, "%s %s %s %s %d %ld %s %d \n",\ | ||
36 | thisProgram, otherProgram, thisCore, otherCore, maxJobs,\ | ||
37 | progTime[jobsComplete], runID, jobsComplete);\ | ||
38 | }\ | ||
39 | fclose(fp);\ | ||
40 | } | ||
41 | |||
42 | #define KILL_CACHE bigArray=(char *)malloc(L3_CACHE_SIZE);\ | ||
43 | if (bigArray==NULL) perror("Malloc failed.\n");\ | ||
44 | memset(bigArray, 1, L3_CACHE_SIZE);\ | ||
45 | munlock(bigArray, L3_CACHE_SIZE);\ | ||
46 | free(bigArray);\ | ||
47 | bigArray=NULL; | ||
48 | |||
49 | |||
50 | |||
51 | //invoke start timer twice, stop timer to make sure timer and vars are in cache | ||
52 | #define START_TIMER clock_gettime(CLOCK_MONOTONIC, &start);\ | ||
53 | clock_gettime(CLOCK_MONOTONIC, &end);\ | ||
54 | clock_gettime(CLOCK_MONOTONIC, &start);\ | ||
55 | |||
56 | #define STOP_TIMER clock_gettime(CLOCK_MONOTONIC, &end); | ||
57 | |||
58 | |||
59 | #define START_LOOP START_TIMER | ||
60 | |||
61 | #define STOP_LOOP if (output) {STOP_TIMER SAVE_RESULTS} sleep_next_period(); | ||
62 | |||
63 | |||
64 | /* | ||
65 | Intended structure | ||
66 | |||
67 | main | ||
68 | SET_UP | ||
69 | notice that STOP LOOP negates the ++ if outout=0 | ||
70 | for (jobsComplete=-1; jobsComplete<maxJobs; jobsComplete++){ | ||
71 | KILL_CACHE | ||
72 | START_TIMER | ||
73 | tacleInit(); | ||
74 | tacleMain(); | ||
75 | STOP_TIMER | ||
76 | SAVE_RESULTS | ||
77 | } | ||
78 | WRITE_TO_FILE | ||
79 | tacleReturn | ||
80 | */ | ||
diff --git a/baseline/source/mpeg2/mpeg2.c b/baseline/source/mpeg2/mpeg2.c index a810744..0567225 100644 --- a/baseline/source/mpeg2/mpeg2.c +++ b/baseline/source/mpeg2/mpeg2.c | |||
@@ -48,7 +48,7 @@ | |||
48 | /* | 48 | /* |
49 | Forward declaration of data types | 49 | Forward declaration of data types |
50 | */ | 50 | */ |
51 | #include "../extra.h" | 51 | #include "extra.h" |
52 | struct mbinfo; | 52 | struct mbinfo; |
53 | 53 | ||
54 | 54 | ||
diff --git a/baseline/source/ndes/ndes.c b/baseline/source/ndes/ndes.c index b0f494c..f169c62 100644 --- a/baseline/source/ndes/ndes.c +++ b/baseline/source/ndes/ndes.c | |||
@@ -17,7 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | /* A read from this address will result in an known value of 1 */ | 19 | /* A read from this address will result in an known value of 1 */ |
20 | #include "../extra.h" | 20 | #include "extra.h" |
21 | #define KNOWN_VALUE 1 | 21 | #define KNOWN_VALUE 1 |
22 | #define NDES_WORSTCASE 1 | 22 | #define NDES_WORSTCASE 1 |
23 | /* | 23 | /* |
diff --git a/baseline/source/petrinet/petrinet.c b/baseline/source/petrinet/petrinet.c index cabb40d..6ef3392 100644 --- a/baseline/source/petrinet/petrinet.c +++ b/baseline/source/petrinet/petrinet.c | |||
@@ -25,7 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | 27 | ||
28 | #include "../extra.h" | 28 | #include "extra.h" |
29 | 29 | ||
30 | #ifdef PROFILING | 30 | #ifdef PROFILING |
31 | #include <stdio.h> | 31 | #include <stdio.h> |
diff --git a/baseline/source/rijndael_dec/rijndael_dec.c b/baseline/source/rijndael_dec/rijndael_dec.c index 93bb424..61db767 100644 --- a/baseline/source/rijndael_dec/rijndael_dec.c +++ b/baseline/source/rijndael_dec/rijndael_dec.c | |||
@@ -38,7 +38,7 @@ | |||
38 | ----------------------------------------------------------------------- | 38 | ----------------------------------------------------------------------- |
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include "../extra.h" | 41 | #include "extra.h" |
42 | #include "aes.h" | 42 | #include "aes.h" |
43 | #include "rijndael_dec_libc.h" | 43 | #include "rijndael_dec_libc.h" |
44 | 44 | ||
diff --git a/baseline/source/rijndael_enc/rijndael_enc.c b/baseline/source/rijndael_enc/rijndael_enc.c index 0c10353..6c85eee 100644 --- a/baseline/source/rijndael_enc/rijndael_enc.c +++ b/baseline/source/rijndael_enc/rijndael_enc.c | |||
@@ -38,7 +38,7 @@ | |||
38 | ----------------------------------------------------------------------- | 38 | ----------------------------------------------------------------------- |
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include "../extra.h" | 41 | #include "extra.h" |
42 | #include "aes.h" | 42 | #include "aes.h" |
43 | #include "rijndael_enc_libc.h" | 43 | #include "rijndael_enc_libc.h" |
44 | 44 | ||
diff --git a/baseline/source/statemate/statemate.c b/baseline/source/statemate/statemate.c index 00491e5..888d0fa 100644 --- a/baseline/source/statemate/statemate.c +++ b/baseline/source/statemate/statemate.c | |||
@@ -27,7 +27,7 @@ | |||
27 | Macro definitions | 27 | Macro definitions |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "../extra.h" | 30 | #include "extra.h" |
31 | 31 | ||
32 | #define SYS_bit_get(a,b) (a)[(b)] | 32 | #define SYS_bit_get(a,b) (a)[(b)] |
33 | #define SYS_bit_clr(a,b) (a)[(b)] = 0 | 33 | #define SYS_bit_clr(a,b) (a)[(b)] = 0 |
diff --git a/baseline/source/susan/susan.c b/baseline/source/susan/susan.c index 4bc4cb8..dc27fb1 100644 --- a/baseline/source/susan/susan.c +++ b/baseline/source/susan/susan.c | |||
@@ -269,7 +269,7 @@ | |||
269 | 269 | ||
270 | \**********************************************************************/ | 270 | \**********************************************************************/ |
271 | 271 | ||
272 | #include "../extra.h" | 272 | #include "extra.h" |
273 | #include "wcclibm.h" | 273 | #include "wcclibm.h" |
274 | #include "wccfile.h" | 274 | #include "wccfile.h" |
275 | #include "wccmalloc.h" | 275 | #include "wccmalloc.h" |
diff --git a/dis/Makefile b/dis/Makefile index 2c1ff89..df93116 100755 --- a/dis/Makefile +++ b/dis/Makefile | |||
@@ -4,34 +4,33 @@ | |||
4 | # that a good Makefile should follow. Sorry - at least I have one.) | 4 | # that a good Makefile should follow. Sorry - at least I have one.) |
5 | LIBLITMUS ?= /media/speedy/litmus/liblitmus | 5 | LIBLITMUS ?= /media/speedy/litmus/liblitmus |
6 | CC ?= gcc | 6 | CC ?= gcc |
7 | override CFLAGS += -pthread -O2 | 7 | CFLAGS += -pthread -O2 -I.. |
8 | LDFLAGS = -lrt -lm | 8 | LDFLAGS = -lrt -lm |
9 | 9 | COMMON = ../extra.h | |
10 | # We need a different include path depending on the target, so use a | ||
11 | # target-specific variable | ||
12 | field matrix neighborhood pointer transitive update random_walk: override CFLAGS += -I../baseline/source | ||
13 | field matrix neighborhood pointer transitive update random_walk: COMMON = ../baseline/source/extra.h | ||
14 | field_all matrix_all neighborhood_all pointer_all transitive_all update_all: override CFLAGS += -I../all_pairs/source | ||
15 | field_all matrix_all neighborhood_all pointer_all transitive_all update_all: COMMON = ../all_pairs/source/extra.h | ||
16 | 10 | ||
17 | # Handle cases where we're also profiling with the MMDC on the i.MX6Q | 11 | # Handle cases where we're also profiling with the MMDC on the i.MX6Q |
18 | ifneq ($(shell grep "define MMDC 1" ../baseline/source/extra.h),) | 12 | ifneq ($(shell grep "define MMDC 1" ../extra.h),) |
19 | COMMON += /media/speedy/litmus/tools/mmdc/mmdc.c | 13 | COMMON += /media/speedy/litmus/tools/mmdc/mmdc.c |
20 | endif | 14 | endif |
21 | 15 | ||
22 | # Include all the LITMUS^RT headers if we're using it | 16 | # Include all the LITMUS^RT headers if we're using it |
23 | ifneq ($(shell grep "define LITMUS 1" ../baseline/source/extra.h),) | 17 | ifneq ($(shell grep "define LITMUS 1" ../extra.h),) |
24 | CFLAGS += -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include | 18 | CFLAGS += -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include |
25 | LDFLAGS += -L${LIBLITMUS} -llitmus | 19 | LDFLAGS += -L${LIBLITMUS} -llitmus |
26 | endif | 20 | endif |
27 | 21 | ||
28 | all: baseline | 22 | all: baseline |
23 | debug: baseline | ||
24 | debug_pairs: pairs | ||
25 | debug debug_pairs: CFLAGS += -ggdb3 | ||
29 | baseline: field matrix neighborhood pointer transitive update random_walk | 26 | baseline: field matrix neighborhood pointer transitive update random_walk |
30 | pairs: field_all matrix_all neighborhood_all pointer_all transitive_all update_all | 27 | pairs: field_all matrix_all neighborhood_all pointer_all transitive_all update_all |
31 | 28 | ||
32 | .PHONY: clean | 29 | .PHONY: clean |
33 | clean: | 30 | clean: |
34 | rm field_all matrix_all neighborhood_all pointer_all transitive_all update_all field matrix neighborhood pointer transitive update random_walk | 31 | rm -f field_all matrix_all neighborhood_all pointer_all \ |
32 | transitive_all update_all field matrix neighborhood \ | ||
33 | pointer transitive update random_walk | ||
35 | 34 | ||
36 | field: ${COMMON} ./Field/field.c | 35 | field: ${COMMON} ./Field/field.c |
37 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 36 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
@@ -49,14 +48,14 @@ random_walk: ${COMMON} random_walk.c | |||
49 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 48 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
50 | 49 | ||
51 | field_all: ${COMMON} ./Field/field.c | 50 | field_all: ${COMMON} ./Field/field.c |
52 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 51 | $(CC) $(CFLAGS) -DPAIRED $^ -o $@ $(LDFLAGS) |
53 | matrix_all: ${COMMON} ./Matrix/ver2/matrix.c | 52 | matrix_all: ${COMMON} ./Matrix/ver2/matrix.c |
54 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 53 | $(CC) $(CFLAGS) -DPAIRED $^ -o $@ $(LDFLAGS) |
55 | neighborhood_all: ${COMMON} ./Neighborhood/neighborhood.c | 54 | neighborhood_all: ${COMMON} ./Neighborhood/neighborhood.c |
56 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 55 | $(CC) $(CFLAGS) -DPAIRED $^ -o $@ $(LDFLAGS) |
57 | pointer_all: ${COMMON} ./Pointer/pointer.c | 56 | pointer_all: ${COMMON} ./Pointer/pointer.c |
58 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 57 | $(CC) $(CFLAGS) -DPAIRED $^ -o $@ $(LDFLAGS) |
59 | transitive_all: ${COMMON} ./Transitive/transitive.c | 58 | transitive_all: ${COMMON} ./Transitive/transitive.c |
60 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 59 | $(CC) $(CFLAGS) -DPAIRED $^ -o $@ $(LDFLAGS) |
61 | update_all: ${COMMON} ./Update/update.c | 60 | update_all: ${COMMON} ./Update/update.c |
62 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 61 | $(CC) $(CFLAGS) -DPAIRED $^ -o $@ $(LDFLAGS) |
diff --git a/baseline/source/extra.h b/extra.h index e8f3d18..3215951 100644 --- a/baseline/source/extra.h +++ b/extra.h | |||
@@ -2,18 +2,18 @@ | |||
2 | * Copyright 2019 Sims Hill Osborne and Joshua Bakita | 2 | * Copyright 2019 Sims Hill Osborne and Joshua Bakita |
3 | * | 3 | * |
4 | * This header provides facilities by which to separably run and time TACLeBench | 4 | * This header provides facilities by which to separably run and time TACLeBench |
5 | * To use this for paired task timing, define PAIRED (pass CFLAGS=-DPAIRED to make) | ||
5 | **/ | 6 | **/ |
6 | #define _GNU_SOURCE | 7 | #define _GNU_SOURCE |
7 | #include <time.h> | 8 | #include <fcntl.h> // For O_CREAT and O_RDWR |
8 | #include <sys/mman.h> | 9 | #include <sched.h> // For sched_yield() |
9 | #include <stdlib.h> | 10 | #include <semaphore.h> // For sem_{open, post, wait}() |
10 | #include <stdio.h> | 11 | #include <stdio.h> |
11 | #include <string.h> | 12 | #include <stdlib.h> // For exit() |
12 | #include <signal.h> | 13 | #include <string.h> // For strlen() |
13 | #include <limits.h> | 14 | #include <sys/mman.h> // For mlockall() |
14 | #include <fcntl.h> | 15 | #include <unistd.h> // For ftruncate() |
15 | #include <stdint.h> | 16 | #include <time.h> |
16 | #include <sched.h> | ||
17 | 17 | ||
18 | // This is only visible if _GNU_SOURCE is defined, and that define does not | 18 | // This is only visible if _GNU_SOURCE is defined, and that define does not |
19 | // come along to places where this file is included. Address this by manually | 19 | // come along to places where this file is included. Address this by manually |
@@ -55,7 +55,13 @@ extern int sched_getcpu(); | |||
55 | 55 | ||
56 | // Store state globally so that the job can be outside main() | 56 | // Store state globally so that the job can be outside main() |
57 | // Arrays use float as a comprimise between overflow and size | 57 | // Arrays use float as a comprimise between overflow and size |
58 | // Paired arrays use long longs as precision is more important for those times | ||
59 | #ifdef PAIRED | ||
60 | long long *_rt_start_time; | ||
61 | long long *_rt_end_time; | ||
62 | #else | ||
58 | float *_rt_exec_time; | 63 | float *_rt_exec_time; |
64 | #endif | ||
59 | #if MMDC_PERF | 65 | #if MMDC_PERF |
60 | float *_rt_mmdc_read; | 66 | float *_rt_mmdc_read; |
61 | float *_rt_mmdc_write; | 67 | float *_rt_mmdc_write; |
@@ -68,36 +74,103 @@ struct timespec _rt_start, _rt_end; | |||
68 | 74 | ||
69 | char *_rt_run_id; | 75 | char *_rt_run_id; |
70 | char *_rt_our_prog_name; | 76 | char *_rt_our_prog_name; |
77 | char *_rt_other_prog_name; | ||
78 | char *_rt_other_core; | ||
71 | #define _RT_FILENAME_LEN 64 | 79 | #define _RT_FILENAME_LEN 64 |
80 | #define _BILLION (1000*1000*1000) | ||
81 | #ifdef PAIRED | ||
82 | char *_rt_barrier; | ||
83 | sem_t *_rt_first_sem, *_rt_second_sem; | ||
84 | int _rt_lock_id; | ||
85 | #endif | ||
72 | 86 | ||
73 | #define LOAD_PARAMS_ITRL \ | 87 | static void _rt_load_params_itrl(int argc, char **argv) { |
74 | if (argc != 6) { \ | 88 | #ifdef PAIRED |
75 | fprintf(stderr, "Usage: %s <name> <loops> <my core> <runID> <save results?>\n", argv[0]);\ | 89 | if (argc != 8) { |
76 | fprintf(stderr, " <loops> integer number of iterations. -1 for infitite.\n");\ | 90 | fprintf(stderr, "Usage: %s <name> <loops> <my core> <other core> <other name> <runID> <lockID>", argv[0]); |
77 | fprintf(stderr, " <save results?> 1 to save results, 0 to discard.\n");\ | 91 | fprintf(stderr, " <name> string for logging. Name of this task.\n"); |
78 | fprintf(stderr, " <my core> UNUSED. Core is now auto-detected.\n");\ | 92 | fprintf(stderr, " <loops> integer number of iterations. -1 for infinite.\n"); |
79 | exit(1);\ | 93 | fprintf(stderr, " <my core> UNUSED. Core is now auto-detected.\n"); |
80 | }\ | 94 | fprintf(stderr, " <other core> integer for logging. Core of paired task.\n"); |
81 | _rt_our_prog_name = argv[1];\ | 95 | fprintf(stderr, " <other name> string for logging. Name of paired task.\n"); |
82 | _rt_max_jobs = atol(argv[2]);\ | 96 | fprintf(stderr, " <runID> string to append with .txt to yield output file name.\n"); |
83 | _rt_core = sched_getcpu();\ | 97 | fprintf(stderr, " <lockID> 1 to indicate this is pair member 1, otherwise pair member 2.\n"); |
84 | _rt_run_id = argv[4];\ | 98 | exit(1); |
85 | _rt_will_output = atoi(argv[5]);\ | 99 | } |
86 | if (_rt_max_jobs < 0 && _rt_will_output != 0) {\ | 100 | #else |
87 | fprintf(stderr, "Infinite loops only supported when _rt_will_output is disabled!\n");\ | 101 | if (argc != 6) { |
88 | exit(1);\ | 102 | fprintf(stderr, "Usage: %s <name> <loops> <my core> <runID> <save results?>\n", argv[0]); |
89 | }\ | 103 | fprintf(stderr, " <name> string for logging. Name of this task.\n"); |
90 | if (strlen(_rt_run_id) + 5 > _RT_FILENAME_LEN) {\ | 104 | fprintf(stderr, " <loops> integer number of iterations. -1 for infinite.\n"); |
91 | fprintf(stderr, "Run ID is too large! Keep it to less than %d characters.\n", _RT_FILENAME_LEN);\ | 105 | fprintf(stderr, " <my core> UNUSED. Core is now auto-detected.\n"); |
92 | exit(1);\ | 106 | fprintf(stderr, " <runID> string to append with .txt to yield output file name.\n"); |
93 | }\ | 107 | fprintf(stderr, " <save results?> 1 to save results, 0 to discard.\n"); |
94 | _rt_exec_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(float));\ | 108 | exit(1); |
95 | if (!_rt_exec_time) {\ | 109 | } |
96 | perror("Unable to allocate buffer for execution times");\ | 110 | #endif |
97 | exit(1);\ | 111 | _rt_our_prog_name = argv[1]; |
98 | }\ | 112 | _rt_max_jobs = atol(argv[2]); |
99 | _rt_jobs_complete = 0;\ | 113 | _rt_core = sched_getcpu(); |
114 | #ifdef PAIRED | ||
115 | _rt_other_core = argv[4]; | ||
116 | _rt_other_prog_name = argv[5]; | ||
117 | _rt_run_id = argv[6]; | ||
118 | _rt_lock_id = atoi(argv[7]); | ||
119 | // The paired version doesn't support disabling output (legacy compatibility) | ||
120 | _rt_will_output = 1; | ||
121 | #else | ||
122 | _rt_other_core = "none"; | ||
123 | _rt_other_prog_name = "none"; | ||
124 | _rt_run_id = argv[4]; | ||
125 | _rt_will_output = atoi(argv[5]); | ||
126 | #endif /* PAIRED */ | ||
127 | if (_rt_max_jobs < 0 && _rt_will_output != 0) { | ||
128 | fprintf(stderr, "Infinite loops only supported when _rt_will_output is disabled!\n"); | ||
129 | exit(1); | ||
130 | } | ||
131 | if (strlen(_rt_run_id) + 5 > _RT_FILENAME_LEN) { | ||
132 | fprintf(stderr, "Run ID is too large! Keep it to less than %d characters.\n", _RT_FILENAME_LEN); | ||
133 | exit(1); | ||
134 | } | ||
135 | #ifdef PAIRED | ||
136 | _rt_start_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(long long)); | ||
137 | _rt_end_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(long long)); | ||
138 | if (!_rt_end_time || !_rt_start_time) { | ||
139 | perror("Unable to allocate buffers for execution times"); | ||
140 | exit(1); | ||
141 | } | ||
142 | _rt_first_sem = sem_open("/_libextra_first_sem", O_CREAT, 644, 0); | ||
143 | _rt_second_sem = sem_open("/_libextra_second_sem", O_CREAT, 644, 0); | ||
144 | if (_rt_first_sem == SEM_FAILED || _rt_second_sem == SEM_FAILED) { | ||
145 | perror("Error while creating semaphores"); | ||
146 | exit(1); | ||
147 | } | ||
148 | int barrier_file = shm_open("/_libextra_barrier", O_CREAT | O_RDWR, 644); | ||
149 | if (barrier_file == -1) { | ||
150 | perror("Error while creating shared memory for barrier synchronization"); | ||
151 | exit(1); | ||
152 | } | ||
153 | if (ftruncate(barrier_file, 1) == -1) { | ||
154 | perror("Error while setting size of shared memory for barrier synchronization"); | ||
155 | exit(1); | ||
156 | } | ||
157 | _rt_barrier = mmap(NULL, 1, PROT_WRITE, MAP_SHARED, barrier_file, 0); | ||
158 | if (_rt_barrier == MAP_FAILED) { | ||
159 | perror("Error while mapping shared memory for barrier synchronization"); | ||
160 | exit(1); | ||
161 | } | ||
162 | *_rt_barrier = 0; | ||
163 | #else | ||
164 | _rt_exec_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(float)); | ||
165 | if (!_rt_exec_time) { | ||
166 | perror("Unable to allocate buffer for execution times"); | ||
167 | exit(1); | ||
168 | } | ||
169 | #endif /* PAIRED */ | ||
170 | _rt_jobs_complete = 0; | ||
100 | mlockall(MCL_CURRENT || MCL_FUTURE); | 171 | mlockall(MCL_CURRENT || MCL_FUTURE); |
172 | } | ||
173 | #define LOAD_PARAMS_ITRL _rt_load_params_itrl(argc, argv); | ||
101 | 174 | ||
102 | #define SETUP_MMDC \ | 175 | #define SETUP_MMDC \ |
103 | _rt_mmdc_read = calloc(_rt_max_jobs * _rt_will_output, sizeof(float));\ | 176 | _rt_mmdc_read = calloc(_rt_max_jobs * _rt_will_output, sizeof(float));\ |
@@ -213,6 +286,44 @@ char *_rt_our_prog_name; | |||
213 | fclose(fp); | 286 | fclose(fp); |
214 | #endif | 287 | #endif |
215 | 288 | ||
289 | // This semaphore-based synchronization is from Sims | ||
290 | #define FIRST_UNLOCK \ | ||
291 | if (_rt_lock_id == 1) {\ | ||
292 | if (sem_post(_rt_second_sem) != 0) {\ | ||
293 | perror("Unable to unlock second semaphore");\ | ||
294 | exit(1);\ | ||
295 | }\ | ||
296 | } \ | ||
297 | else {\ | ||
298 | if (sem_post(_rt_first_sem) != 0) {\ | ||
299 | perror("Unable to unlock first semaphore");\ | ||
300 | exit(1);\ | ||
301 | }\ | ||
302 | } \ | ||
303 | |||
304 | #define FIRST_LOCK \ | ||
305 | if (_rt_lock_id == 1) {\ | ||
306 | if (sem_wait(_rt_first_sem) != 0) {\ | ||
307 | perror("Unable to wait on first semaphore");\ | ||
308 | exit(1);\ | ||
309 | }\ | ||
310 | }\ | ||
311 | else {\ | ||
312 | if (sem_wait(_rt_second_sem) != 0) {\ | ||
313 | perror("Unable to wait on second semaphore");\ | ||
314 | exit(1);\ | ||
315 | }\ | ||
316 | } | ||
317 | |||
318 | // This ensures a very low difference between pair member start times | ||
319 | #define BARRIER_SYNC \ | ||
320 | if (__sync_bool_compare_and_swap(_rt_barrier, 0, 1)) {\ | ||
321 | while (!__sync_bool_compare_and_swap(_rt_barrier, 0, 0)) {};\ | ||
322 | }\ | ||
323 | else {\ | ||
324 | __sync_bool_compare_and_swap(_rt_barrier, 1, 0);\ | ||
325 | } | ||
326 | |||
216 | // Buffer timing result from a single job | 327 | // Buffer timing result from a single job |
217 | static void _rt_save_job_result() { | 328 | static void _rt_save_job_result() { |
218 | if (_rt_jobs_complete >= _rt_max_jobs) { | 329 | if (_rt_jobs_complete >= _rt_max_jobs) { |
@@ -220,9 +331,18 @@ static void _rt_save_job_result() { | |||
220 | exit(1); | 331 | exit(1); |
221 | } | 332 | } |
222 | if (_rt_jobs_complete > -1 && _rt_will_output) { | 333 | if (_rt_jobs_complete > -1 && _rt_will_output) { |
334 | #ifdef PAIRED | ||
335 | _rt_start_time[_rt_jobs_complete] = _rt_start.tv_sec; | ||
336 | _rt_start_time[_rt_jobs_complete] *= _BILLION; | ||
337 | _rt_start_time[_rt_jobs_complete] += _rt_start.tv_nsec; | ||
338 | _rt_end_time[_rt_jobs_complete] = _rt_end.tv_sec; | ||
339 | _rt_end_time[_rt_jobs_complete] *= _BILLION; | ||
340 | _rt_end_time[_rt_jobs_complete] += _rt_end.tv_nsec; | ||
341 | #else | ||
223 | _rt_exec_time[_rt_jobs_complete] = _rt_end.tv_sec - _rt_start.tv_sec; | 342 | _rt_exec_time[_rt_jobs_complete] = _rt_end.tv_sec - _rt_start.tv_sec; |
224 | _rt_exec_time[_rt_jobs_complete] *= 1e9; | 343 | _rt_exec_time[_rt_jobs_complete] *= _BILLION; |
225 | _rt_exec_time[_rt_jobs_complete] += _rt_end.tv_nsec - _rt_start.tv_nsec; | 344 | _rt_exec_time[_rt_jobs_complete] += _rt_end.tv_nsec - _rt_start.tv_nsec; |
345 | #endif /* PAIRED */ | ||
226 | #if MMDC_PROF | 346 | #if MMDC_PROF |
227 | _rt_mmdc_read[_rt_jobs_complete] = mmdc_res.read_bytes; | 347 | _rt_mmdc_read[_rt_jobs_complete] = mmdc_res.read_bytes; |
228 | _rt_mmdc_write[_rt_jobs_complete] = mmdc_res.write_bytes; | 348 | _rt_mmdc_write[_rt_jobs_complete] = mmdc_res.write_bytes; |
@@ -234,31 +354,54 @@ static void _rt_save_job_result() { | |||
234 | static void _rt_write_to_file() { | 354 | static void _rt_write_to_file() { |
235 | char fileName[_RT_FILENAME_LEN]; | 355 | char fileName[_RT_FILENAME_LEN]; |
236 | FILE *fp; | 356 | FILE *fp; |
237 | if (!_rt_will_output) | ||
238 | return; | ||
239 | munlockall(); | 357 | munlockall(); |
358 | if (!_rt_will_output) | ||
359 | goto out; | ||
240 | strcpy(fileName, _rt_run_id); | 360 | strcpy(fileName, _rt_run_id); |
241 | strcat(fileName, ".txt"); | 361 | strcat(fileName, ".txt"); |
242 | fp = fopen(fileName, "a"); | 362 | fp = fopen(fileName, "a"); |
243 | if (fp == NULL) { | 363 | if (fp == NULL) { |
244 | perror("Unable to open _rt_will_output file"); | 364 | perror("Unable to open output file"); |
245 | exit(1); | 365 | exit(1); |
246 | } | 366 | } |
247 | // Same format as the paired results with "none" for unused fields | 367 | // Baseline output uses a similar format with "none" for unused fields |
248 | for (int i = 0; i < _rt_jobs_complete; i++){ | 368 | for (int i = 0; i < _rt_jobs_complete; i++){ |
249 | fprintf(fp, "%s none %u none %ld %.f %s %d %.f %.f \n", | 369 | fprintf(fp, "%s %s %u %s %ld", _rt_our_prog_name, _rt_other_prog_name, |
250 | _rt_our_prog_name, _rt_core, _rt_max_jobs, | 370 | _rt_core, _rt_other_core, _rt_max_jobs); |
251 | _rt_exec_time[i], _rt_run_id, i, | 371 | #ifdef PAIRED |
372 | // For unclear legacy reasons, paired tasks emit sec and ns separately | ||
373 | fprintf(fp, " %lld %lld %lld %lld", | ||
374 | _rt_start_time[i] / _BILLION, _rt_start_time[i] % _BILLION, | ||
375 | _rt_end_time[i] / _BILLION, _rt_end_time[i] % _BILLION); | ||
376 | #else | ||
377 | fprintf(fp, " %.f", _rt_exec_time[i]); | ||
378 | #endif /* PAIRED */ | ||
379 | fprintf(fp, " %s %d %.f %.f\n", _rt_run_id, i, | ||
252 | #if MMDC_PROF | 380 | #if MMDC_PROF |
253 | _rt_mmdc_read[i], _rt_mmdc_write[i]); | 381 | _rt_mmdc_read[i], _rt_mmdc_write[i]); |
254 | #else | 382 | #else |
255 | 0.0, 0.0); | 383 | 0.0, 0.0); |
256 | #endif | 384 | #endif /* MMDC_PROF */ |
257 | } | 385 | } |
258 | fclose(fp); | 386 | fclose(fp); |
387 | out: | ||
259 | #if LITMUS | 388 | #if LITMUS |
260 | CLEANUP_LITMUS | 389 | CLEANUP_LITMUS |
261 | #endif | 390 | #endif /* LITMUS */ |
391 | #ifdef PAIRED | ||
392 | munmap(_rt_barrier, 1); | ||
393 | shm_unlink("/_libextra_barrier"); | ||
394 | sem_unlink("/_libextra_first_sem"); | ||
395 | sem_unlink("/_libextra_second_sem"); | ||
396 | free(_rt_start_time); | ||
397 | free(_rt_end_time); | ||
398 | #else | ||
399 | free(_rt_exec_time); | ||
400 | #endif /* PAIRED */ | ||
401 | #if MMDC_PROF | ||
402 | free(_rt_mmdc_read); | ||
403 | free(_rt_mmdc_write); | ||
404 | #endif /* MMDC_PROF */ | ||
262 | } | 405 | } |
263 | 406 | ||
264 | // Start a job | 407 | // Start a job |
@@ -269,12 +412,19 @@ static void _rt_start_loop() { | |||
269 | } | 412 | } |
270 | #else | 413 | #else |
271 | sched_yield(); | 414 | sched_yield(); |
272 | #endif | 415 | #endif /* LITMUS */ |
416 | #ifdef PAIRED | ||
417 | FIRST_UNLOCK | ||
418 | FIRST_LOCK | ||
419 | #endif /* PAIRED */ | ||
273 | FLUSH_CACHES | 420 | FLUSH_CACHES |
421 | #ifdef PAIRED | ||
422 | BARRIER_SYNC | ||
423 | #endif /* PAIRED */ | ||
274 | #if MMDC_PROF | 424 | #if MMDC_PROF |
275 | /* This disables profiling, resets the counters, clears the overflow bit, and enables profiling */ | 425 | /* This disables profiling, resets the counters, clears the overflow bit, and enables profiling */ |
276 | start_mmdc_profiling(mmdc); | 426 | start_mmdc_profiling(mmdc); |
277 | #endif | 427 | #endif /* MMDC_PROF */ |
278 | clock_gettime(CLOCK_MONOTONIC, &_rt_start); | 428 | clock_gettime(CLOCK_MONOTONIC, &_rt_start); |
279 | } | 429 | } |
280 | 430 | ||
@@ -285,7 +435,7 @@ static void _rt_stop_loop() { | |||
285 | /* This freezes the profiling and makes results available */ | 435 | /* This freezes the profiling and makes results available */ |
286 | pause_mmdc_profiling(mmdc); | 436 | pause_mmdc_profiling(mmdc); |
287 | get_mmdc_profiling_results(mmdc, &mmdc_res); | 437 | get_mmdc_profiling_results(mmdc, &mmdc_res); |
288 | #endif | 438 | #endif /* MMDC_PROF */ |
289 | _rt_save_job_result(); | 439 | _rt_save_job_result(); |
290 | _rt_jobs_complete++; | 440 | _rt_jobs_complete++; |
291 | } | 441 | } |