Skip to content
Snippets Groups Projects
Commit c13bde93 authored by 13517050-Billy's avatar 13517050-Billy
Browse files

fixed makefile

parent 7680ec8f
No related merge requests found
...@@ -6,8 +6,8 @@ FILE= omp_dijkstra ...@@ -6,8 +6,8 @@ FILE= omp_dijkstra
# make compile # make compile
compile: $ compile: $
echo "compiling" echo "compiling"
gcc -g -Wall -o ${FILE} ${FILE}.c -fopenmp gcc -g -Wall -o out/${FILE} src/${FILE}.c -fopenmp \
# make run N={node_size} T={thread_count} # make run N={node_size} T={thread_count}
run: ./${FILE} run: ./out/${FILE}
./${FILE} ${N} ${T}\ ./out/${FILE} ${N} ${T}\
This diff is collapsed.
File added
This diff is collapsed.
0 19 70 14 21
49 0 1 59 86
41 37 0 73 6
59 61 40 0 48
93 56 25 92 0
...@@ -64,7 +64,7 @@ void printGraph(int graph[V][V], int size) { ...@@ -64,7 +64,7 @@ void printGraph(int graph[V][V], int size) {
// Write to file // Write to file
void writeToFile(int result[V][V], int size) { void writeToFile(int result[V][V], int size) {
FILE *fp; FILE *fp;
fp = fopen("result.txt", "w"); fp = fopen("out/result.txt", "w");
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
for (int j = 0; j < (size - 1); j++) { for (int j = 0; j < (size - 1); j++) {
...@@ -77,7 +77,7 @@ void writeToFile(int result[V][V], int size) { ...@@ -77,7 +77,7 @@ void writeToFile(int result[V][V], int size) {
void writeGraphToFile(int graph[V][V], int size) { void writeGraphToFile(int graph[V][V], int size) {
FILE *fp; FILE *fp;
fp = fopen("graph.txt", "w"); fp = fopen("out/graph.txt", "w");
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
for (int j = 0; j < (size - 1); j++) { for (int j = 0; j < (size - 1); j++) {
...@@ -156,14 +156,13 @@ void paralelDijkstra(int size) { ...@@ -156,14 +156,13 @@ void paralelDijkstra(int size) {
printf("size = %d\n", size); printf("size = %d\n", size);
for (i = myRank; i < size; i += thread_count) { for (i = myRank; i < size; i += thread_count) {
printf("test = %d\n", i);
dijkstra(graph, i, size, result[i]); dijkstra(graph, i, size, result[i]);
if (i == 0) { if (i == 0) {
for (j = 0; j < size; j++) { for (j = 0; j < size; j++) {
printf("%d\n", result[i][j]); printf("%d\n", result[i][j]);
} }
} }
printf("Set by thread %d for node: %d out of %d", myRank, i, size); printf("Set by thread %d for node: %d out of %d\n", myRank, i, size);
} }
} }
......
0 19 20 14 21
42 0 1 56 7
41 37 0 55 6
59 61 40 0 46
66 56 25 80 0
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment