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

fix output placing folder

parent 0851b0dd
No related merge requests found
.SILENT: $
.SILENT:
CC = gcc
FILE= omp_dijkstra
# make compile
compile: $
echo "compiling"
gcc -g -Wall -o out/${FILE} src/${FILE}.c -fopenmp \
compile:
echo "compiling..."
${CC} -g -Wall -o out/${FILE} src/${FILE}.c -fopenmp
echo "done" \
# make run N={node_size} T={thread_count}
run: ./out/${FILE}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
int sumTotal = 0;
void Hello(void); /* Thread function */
void world(void);
int main(int argc, char *argv[]) {
int thread_count = strtol(argv[1], NULL, 10);
#pragma omp parallel num_threads(thread_count)
Hello();
world();
return 0;
}
void Hello(void) {
int my_rank = omp_get_thread_num();
int thread_count = omp_get_num_threads();
printf("Hello from thread %d of %d\n", my_rank, thread_count);
}
void world(void){
int my_rank = omp_get_thread_num();
int thread_count = omp_get_num_threads();
printf("World from thread %d of %d\n", my_rank, thread_count);
}
\ No newline at end of file
......@@ -64,7 +64,7 @@ void printGraph(int graph[V][V], int size) {
// Write to file
void writeToFile(int size) {
FILE *fp;
fp = fopen("result.txt", "w");
fp = fopen("out/result.txt", "w");
for (int i = 0; i < size; i++) {
for (int j = 0; j < (size - 1); j++) {
......@@ -76,7 +76,7 @@ void writeToFile(int size) {
void writeGraphToFile(int size) {
FILE *fp;
fp = fopen("graph.txt", "w");
fp = fopen("out/graph.txt", "w");
for (int i = 0; i < size; i++) {
for (int j = 0; j < (size - 1); j++) {
......
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