diff --git a/A2/Makefile b/A2/Makefile index 5bde0ee..ae5d7a0 100755 --- a/A2/Makefile +++ b/A2/Makefile @@ -1,12 +1,12 @@ CC = gcc CFLAGS = -std=gnu99 -O3 -fopenmp -Wall BIN = assignment2 all: $(BIN) -$(BIN): assignment2.c utility.h algorithm_trivial.c +$(BIN): assignment2.c utility.h algorithm_collapse.c $(CC) $(CFLAGS) $< -o $@ clean: rm -f $(BIN) *.o diff --git a/A2/assignment2.c b/A2/assignment2.c index 4f096bb..d060de1 100644 --- a/A2/assignment2.c +++ b/A2/assignment2.c @@ -1,78 +1,78 @@ /* ============================================================================ Filename : assignment2.c Author : Arash Pourhabibi, Hussein Kassir ============================================================================ */ #include #include #include #include #include "utility.h" //#include "algorithm_Ancarola.c" //#include "algorithm_test.c" //#include "algorithm.c" //#include "algorithm_slow.c" //#include "algorithm_T_tile.c" //#include "algorithm_1fork.c" //#include "algorithm_onethread.c" -#include "algorithm_trivial.c" -//#include "algorithm_collapse.c" +//#include "algorithm_trivial.c" +#include "algorithm_collapse.c" int main (int argc, const char *argv[]) { int threads, length, iterations; double time; if (argc != 5) { printf("Invalid input! \nUsage: ./assignment2 \n"); return 1; } else { threads = atoi(argv[1]); length = atoi(argv[2]); iterations = atoi(argv[3]); if(length%2!=0) { printf("Invalid input! Array length must be even\n"); return 1; } } //Allocate a two-dimensional array double *input = malloc(sizeof(double)*length*length); double *output = malloc(sizeof(double)*length*length); //Initialize the array init(input, length); init(output, length); //Start timer set_clock(); //Optimize the following function simulate(input, output, threads, length, iterations); //Stop timer time = elapsed_time(); //Report time required for n iterations printf("Running the algorithm with %d threads on %d by %d array for %d iterations took %.4g seconds \n", threads, length, length, iterations, time); if(iterations % 2 == 0){ double *temp = input; input = output; output = temp; } //Save array in filelength if the output is not /dev/null // idea: do not save if not needed if (strcmp(argv[4], "/dev/null") != 0) save(output, length, argv[4]); //Free allocated memory free(input); free(output); return 0; } diff --git a/A2/graph/tests_collapse/slurm-5947466.out b/A2/graph/tests_collapse/slurm-5947466.out new file mode 100644 index 0000000..0f55e7f --- /dev/null +++ b/A2/graph/tests_collapse/slurm-5947466.out @@ -0,0 +1,7 @@ +STARTING AT Mon Oct 26 22:15:26 CET 2020 +Running the algorithm with 1 threads on 5000 by 5000 array for 50 iterations took 6.505 seconds +Running the algorithm with 2 threads on 5000 by 5000 array for 50 iterations took 3.305 seconds +Running the algorithm with 4 threads on 5000 by 5000 array for 50 iterations took 1.664 seconds +Running the algorithm with 8 threads on 5000 by 5000 array for 50 iterations took 0.8262 seconds +Running the algorithm with 16 threads on 5000 by 5000 array for 50 iterations took 0.6692 seconds +FINISHED at Mon Oct 26 22:15:40 CET 2020 diff --git a/A2/graph/tests_collapse/slurm-5947467.out b/A2/graph/tests_collapse/slurm-5947467.out new file mode 100644 index 0000000..446c0b8 --- /dev/null +++ b/A2/graph/tests_collapse/slurm-5947467.out @@ -0,0 +1,7 @@ +STARTING AT Mon Oct 26 22:15:26 CET 2020 +Running the algorithm with 1 threads on 5000 by 5000 array for 50 iterations took 6.522 seconds +Running the algorithm with 2 threads on 5000 by 5000 array for 50 iterations took 3.313 seconds +Running the algorithm with 4 threads on 5000 by 5000 array for 50 iterations took 1.664 seconds +Running the algorithm with 8 threads on 5000 by 5000 array for 50 iterations took 0.826 seconds +Running the algorithm with 16 threads on 5000 by 5000 array for 50 iterations took 0.6141 seconds +FINISHED at Mon Oct 26 22:15:40 CET 2020 diff --git a/A2/graph/tests_collapse/slurm-5947468.out b/A2/graph/tests_collapse/slurm-5947468.out new file mode 100644 index 0000000..a0019fb --- /dev/null +++ b/A2/graph/tests_collapse/slurm-5947468.out @@ -0,0 +1,7 @@ +STARTING AT Mon Oct 26 22:15:26 CET 2020 +Running the algorithm with 1 threads on 5000 by 5000 array for 50 iterations took 6.611 seconds +Running the algorithm with 2 threads on 5000 by 5000 array for 50 iterations took 3.322 seconds +Running the algorithm with 4 threads on 5000 by 5000 array for 50 iterations took 1.662 seconds +Running the algorithm with 8 threads on 5000 by 5000 array for 50 iterations took 0.8264 seconds +Running the algorithm with 16 threads on 5000 by 5000 array for 50 iterations took 0.6129 seconds +FINISHED at Mon Oct 26 22:15:40 CET 2020 diff --git a/A2/graph/tests_collapse/slurm-5947469.out b/A2/graph/tests_collapse/slurm-5947469.out new file mode 100644 index 0000000..8806acd --- /dev/null +++ b/A2/graph/tests_collapse/slurm-5947469.out @@ -0,0 +1,7 @@ +STARTING AT Mon Oct 26 22:15:26 CET 2020 +Running the algorithm with 1 threads on 5000 by 5000 array for 50 iterations took 6.52 seconds +Running the algorithm with 2 threads on 5000 by 5000 array for 50 iterations took 3.313 seconds +Running the algorithm with 4 threads on 5000 by 5000 array for 50 iterations took 1.665 seconds +Running the algorithm with 8 threads on 5000 by 5000 array for 50 iterations took 0.8315 seconds +Running the algorithm with 16 threads on 5000 by 5000 array for 50 iterations took 0.6896 seconds +FINISHED at Mon Oct 26 22:15:40 CET 2020 diff --git a/A2/graph/tests_collapse/slurm-5947470.out b/A2/graph/tests_collapse/slurm-5947470.out new file mode 100644 index 0000000..4bc5525 --- /dev/null +++ b/A2/graph/tests_collapse/slurm-5947470.out @@ -0,0 +1,7 @@ +STARTING AT Mon Oct 26 22:15:26 CET 2020 +Running the algorithm with 1 threads on 5000 by 5000 array for 50 iterations took 6.527 seconds +Running the algorithm with 2 threads on 5000 by 5000 array for 50 iterations took 3.316 seconds +Running the algorithm with 4 threads on 5000 by 5000 array for 50 iterations took 1.663 seconds +Running the algorithm with 8 threads on 5000 by 5000 array for 50 iterations took 0.8278 seconds +Running the algorithm with 16 threads on 5000 by 5000 array for 50 iterations took 0.6816 seconds +FINISHED at Mon Oct 26 22:15:40 CET 2020 diff --git a/A2/graph/tests_collapse/slurm-5947471.out b/A2/graph/tests_collapse/slurm-5947471.out new file mode 100644 index 0000000..020383d --- /dev/null +++ b/A2/graph/tests_collapse/slurm-5947471.out @@ -0,0 +1,7 @@ +STARTING AT Mon Oct 26 22:15:26 CET 2020 +Running the algorithm with 1 threads on 5000 by 5000 array for 50 iterations took 6.525 seconds +Running the algorithm with 2 threads on 5000 by 5000 array for 50 iterations took 3.324 seconds +Running the algorithm with 4 threads on 5000 by 5000 array for 50 iterations took 1.663 seconds +Running the algorithm with 8 threads on 5000 by 5000 array for 50 iterations took 0.8332 seconds +Running the algorithm with 16 threads on 5000 by 5000 array for 50 iterations took 0.6784 seconds +FINISHED at Mon Oct 26 22:15:40 CET 2020 diff --git a/A2/graph/tests_collapse/slurm-5947472.out b/A2/graph/tests_collapse/slurm-5947472.out new file mode 100644 index 0000000..e7478ad --- /dev/null +++ b/A2/graph/tests_collapse/slurm-5947472.out @@ -0,0 +1,7 @@ +STARTING AT Mon Oct 26 22:15:26 CET 2020 +Running the algorithm with 1 threads on 5000 by 5000 array for 50 iterations took 6.497 seconds +Running the algorithm with 2 threads on 5000 by 5000 array for 50 iterations took 3.303 seconds +Running the algorithm with 4 threads on 5000 by 5000 array for 50 iterations took 1.662 seconds +Running the algorithm with 8 threads on 5000 by 5000 array for 50 iterations took 0.8292 seconds +Running the algorithm with 16 threads on 5000 by 5000 array for 50 iterations took 0.6922 seconds +FINISHED at Mon Oct 26 22:15:40 CET 2020 diff --git a/A2/graph/tests_collapse/slurm-5947473.out b/A2/graph/tests_collapse/slurm-5947473.out new file mode 100644 index 0000000..60003f8 --- /dev/null +++ b/A2/graph/tests_collapse/slurm-5947473.out @@ -0,0 +1,7 @@ +STARTING AT Mon Oct 26 22:16:02 CET 2020 +Running the algorithm with 1 threads on 5000 by 5000 array for 50 iterations took 6.52 seconds +Running the algorithm with 2 threads on 5000 by 5000 array for 50 iterations took 3.309 seconds +Running the algorithm with 4 threads on 5000 by 5000 array for 50 iterations took 1.661 seconds +Running the algorithm with 8 threads on 5000 by 5000 array for 50 iterations took 0.828 seconds +Running the algorithm with 16 threads on 5000 by 5000 array for 50 iterations took 0.695 seconds +FINISHED at Mon Oct 26 22:16:16 CET 2020 diff --git a/A2/graph/tests_collapse/slurm-5947474.out b/A2/graph/tests_collapse/slurm-5947474.out new file mode 100644 index 0000000..2db36d6 --- /dev/null +++ b/A2/graph/tests_collapse/slurm-5947474.out @@ -0,0 +1,7 @@ +STARTING AT Mon Oct 26 22:16:02 CET 2020 +Running the algorithm with 1 threads on 5000 by 5000 array for 50 iterations took 6.495 seconds +Running the algorithm with 2 threads on 5000 by 5000 array for 50 iterations took 3.314 seconds +Running the algorithm with 4 threads on 5000 by 5000 array for 50 iterations took 1.666 seconds +Running the algorithm with 8 threads on 5000 by 5000 array for 50 iterations took 0.8309 seconds +Running the algorithm with 16 threads on 5000 by 5000 array for 50 iterations took 0.6297 seconds +FINISHED at Mon Oct 26 22:16:15 CET 2020 diff --git a/A2/graph/tests_collapse/slurm-5947475.out b/A2/graph/tests_collapse/slurm-5947475.out new file mode 100644 index 0000000..5712963 --- /dev/null +++ b/A2/graph/tests_collapse/slurm-5947475.out @@ -0,0 +1,7 @@ +STARTING AT Mon Oct 26 22:16:02 CET 2020 +Running the algorithm with 1 threads on 5000 by 5000 array for 50 iterations took 6.515 seconds +Running the algorithm with 2 threads on 5000 by 5000 array for 50 iterations took 3.315 seconds +Running the algorithm with 4 threads on 5000 by 5000 array for 50 iterations took 1.667 seconds +Running the algorithm with 8 threads on 5000 by 5000 array for 50 iterations took 0.8293 seconds +Running the algorithm with 16 threads on 5000 by 5000 array for 50 iterations took 0.6688 seconds +FINISHED at Mon Oct 26 22:16:16 CET 2020 diff --git a/A2/graph/tests_collapse/slurm-5947476.out b/A2/graph/tests_collapse/slurm-5947476.out new file mode 100644 index 0000000..a6a886c --- /dev/null +++ b/A2/graph/tests_collapse/slurm-5947476.out @@ -0,0 +1,7 @@ +STARTING AT Mon Oct 26 22:16:02 CET 2020 +Running the algorithm with 1 threads on 5000 by 5000 array for 50 iterations took 6.515 seconds +Running the algorithm with 2 threads on 5000 by 5000 array for 50 iterations took 3.315 seconds +Running the algorithm with 4 threads on 5000 by 5000 array for 50 iterations took 1.674 seconds +Running the algorithm with 8 threads on 5000 by 5000 array for 50 iterations took 0.8306 seconds +Running the algorithm with 16 threads on 5000 by 5000 array for 50 iterations took 0.6126 seconds +FINISHED at Mon Oct 26 22:16:16 CET 2020 diff --git a/A2/graph/tests_collapse/slurm-5947477.out b/A2/graph/tests_collapse/slurm-5947477.out new file mode 100644 index 0000000..e38e398 --- /dev/null +++ b/A2/graph/tests_collapse/slurm-5947477.out @@ -0,0 +1,7 @@ +STARTING AT Mon Oct 26 22:16:02 CET 2020 +Running the algorithm with 1 threads on 5000 by 5000 array for 50 iterations took 6.511 seconds +Running the algorithm with 2 threads on 5000 by 5000 array for 50 iterations took 3.316 seconds +Running the algorithm with 4 threads on 5000 by 5000 array for 50 iterations took 1.664 seconds +Running the algorithm with 8 threads on 5000 by 5000 array for 50 iterations took 0.8321 seconds +Running the algorithm with 16 threads on 5000 by 5000 array for 50 iterations took 0.6755 seconds +FINISHED at Mon Oct 26 22:16:16 CET 2020 diff --git a/A2/graph/tests_collapse/slurm-5947478.out b/A2/graph/tests_collapse/slurm-5947478.out new file mode 100644 index 0000000..f37322b --- /dev/null +++ b/A2/graph/tests_collapse/slurm-5947478.out @@ -0,0 +1,7 @@ +STARTING AT Mon Oct 26 22:16:02 CET 2020 +Running the algorithm with 1 threads on 5000 by 5000 array for 50 iterations took 6.528 seconds +Running the algorithm with 2 threads on 5000 by 5000 array for 50 iterations took 3.328 seconds +Running the algorithm with 4 threads on 5000 by 5000 array for 50 iterations took 1.675 seconds +Running the algorithm with 8 threads on 5000 by 5000 array for 50 iterations took 0.8344 seconds +Running the algorithm with 16 threads on 5000 by 5000 array for 50 iterations took 0.7026 seconds +FINISHED at Mon Oct 26 22:16:16 CET 2020 diff --git a/A2/graph/tests_collapse/slurm-5947479.out b/A2/graph/tests_collapse/slurm-5947479.out new file mode 100644 index 0000000..2c78025 --- /dev/null +++ b/A2/graph/tests_collapse/slurm-5947479.out @@ -0,0 +1,7 @@ +STARTING AT Mon Oct 26 22:16:02 CET 2020 +Running the algorithm with 1 threads on 5000 by 5000 array for 50 iterations took 6.511 seconds +Running the algorithm with 2 threads on 5000 by 5000 array for 50 iterations took 3.307 seconds +Running the algorithm with 4 threads on 5000 by 5000 array for 50 iterations took 1.666 seconds +Running the algorithm with 8 threads on 5000 by 5000 array for 50 iterations took 0.829 seconds +Running the algorithm with 16 threads on 5000 by 5000 array for 50 iterations took 0.67 seconds +FINISHED at Mon Oct 26 22:16:16 CET 2020 diff --git a/A2/graph/tests_collapse/slurm-5947480.out b/A2/graph/tests_collapse/slurm-5947480.out new file mode 100644 index 0000000..0b00adc --- /dev/null +++ b/A2/graph/tests_collapse/slurm-5947480.out @@ -0,0 +1,7 @@ +STARTING AT Mon Oct 26 22:16:36 CET 2020 +Running the algorithm with 1 threads on 5000 by 5000 array for 50 iterations took 6.509 seconds +Running the algorithm with 2 threads on 5000 by 5000 array for 50 iterations took 3.305 seconds +Running the algorithm with 4 threads on 5000 by 5000 array for 50 iterations took 1.667 seconds +Running the algorithm with 8 threads on 5000 by 5000 array for 50 iterations took 0.8263 seconds +Running the algorithm with 16 threads on 5000 by 5000 array for 50 iterations took 0.6903 seconds +FINISHED at Mon Oct 26 22:16:50 CET 2020 diff --git a/A2/graph/tests_collapse/slurm-5947481.out b/A2/graph/tests_collapse/slurm-5947481.out new file mode 100644 index 0000000..4b38f01 --- /dev/null +++ b/A2/graph/tests_collapse/slurm-5947481.out @@ -0,0 +1,7 @@ +STARTING AT Mon Oct 26 22:16:36 CET 2020 +Running the algorithm with 1 threads on 5000 by 5000 array for 50 iterations took 6.508 seconds +Running the algorithm with 2 threads on 5000 by 5000 array for 50 iterations took 3.307 seconds +Running the algorithm with 4 threads on 5000 by 5000 array for 50 iterations took 1.665 seconds +Running the algorithm with 8 threads on 5000 by 5000 array for 50 iterations took 0.8294 seconds +Running the algorithm with 16 threads on 5000 by 5000 array for 50 iterations took 0.5716 seconds +FINISHED at Mon Oct 26 22:16:50 CET 2020 diff --git a/A2/graph/tests_collapse/slurm-5947482.out b/A2/graph/tests_collapse/slurm-5947482.out new file mode 100644 index 0000000..54668e3 --- /dev/null +++ b/A2/graph/tests_collapse/slurm-5947482.out @@ -0,0 +1,7 @@ +STARTING AT Mon Oct 26 22:16:36 CET 2020 +Running the algorithm with 1 threads on 5000 by 5000 array for 50 iterations took 6.614 seconds +Running the algorithm with 2 threads on 5000 by 5000 array for 50 iterations took 3.314 seconds +Running the algorithm with 4 threads on 5000 by 5000 array for 50 iterations took 1.669 seconds +Running the algorithm with 8 threads on 5000 by 5000 array for 50 iterations took 0.8276 seconds +Running the algorithm with 16 threads on 5000 by 5000 array for 50 iterations took 0.6895 seconds +FINISHED at Mon Oct 26 22:16:50 CET 2020 diff --git a/A2/graph/tests_collapse/slurm-5947483.out b/A2/graph/tests_collapse/slurm-5947483.out new file mode 100644 index 0000000..718c697 --- /dev/null +++ b/A2/graph/tests_collapse/slurm-5947483.out @@ -0,0 +1,7 @@ +STARTING AT Mon Oct 26 22:16:36 CET 2020 +Running the algorithm with 1 threads on 5000 by 5000 array for 50 iterations took 6.524 seconds +Running the algorithm with 2 threads on 5000 by 5000 array for 50 iterations took 3.308 seconds +Running the algorithm with 4 threads on 5000 by 5000 array for 50 iterations took 1.661 seconds +Running the algorithm with 8 threads on 5000 by 5000 array for 50 iterations took 0.8296 seconds +Running the algorithm with 16 threads on 5000 by 5000 array for 50 iterations took 0.7004 seconds +FINISHED at Mon Oct 26 22:16:50 CET 2020 diff --git a/A2/graph/tests_collapse/slurm-5947484.out b/A2/graph/tests_collapse/slurm-5947484.out new file mode 100644 index 0000000..81ecd9c --- /dev/null +++ b/A2/graph/tests_collapse/slurm-5947484.out @@ -0,0 +1,7 @@ +STARTING AT Mon Oct 26 22:16:36 CET 2020 +Running the algorithm with 1 threads on 5000 by 5000 array for 50 iterations took 6.515 seconds +Running the algorithm with 2 threads on 5000 by 5000 array for 50 iterations took 3.308 seconds +Running the algorithm with 4 threads on 5000 by 5000 array for 50 iterations took 1.667 seconds +Running the algorithm with 8 threads on 5000 by 5000 array for 50 iterations took 0.8284 seconds +Running the algorithm with 16 threads on 5000 by 5000 array for 50 iterations took 0.5756 seconds +FINISHED at Mon Oct 26 22:16:50 CET 2020 diff --git a/A2/graph/tests_collapse/slurm-5947485.out b/A2/graph/tests_collapse/slurm-5947485.out new file mode 100644 index 0000000..c57260a --- /dev/null +++ b/A2/graph/tests_collapse/slurm-5947485.out @@ -0,0 +1,7 @@ +STARTING AT Mon Oct 26 22:16:36 CET 2020 +Running the algorithm with 1 threads on 5000 by 5000 array for 50 iterations took 6.527 seconds +Running the algorithm with 2 threads on 5000 by 5000 array for 50 iterations took 3.319 seconds +Running the algorithm with 4 threads on 5000 by 5000 array for 50 iterations took 1.665 seconds +Running the algorithm with 8 threads on 5000 by 5000 array for 50 iterations took 0.8337 seconds +Running the algorithm with 16 threads on 5000 by 5000 array for 50 iterations took 0.6861 seconds +FINISHED at Mon Oct 26 22:16:50 CET 2020