Skip to content
Snippets Groups Projects
Commit c7f4c072 authored by Joachim Jenke's avatar Joachim Jenke
Browse files

initial commit

parents
No related branches found
No related tags found
No related merge requests found
Makefile 0 → 100644
CC?=icc
.PHONY: all
all: hello.exe hello_lib.exe hello_dlopen.exe libhello.so
hello.exe: hello_omp.c
$(CC) -g -fopenmp hello_omp.c -o hello.exe
hello_lib.exe: main_link.c libhello.so
$(CC) -g main_link.c -o hello_lib.exe -L. -lhello
hello_dlopen.exe: main_dlopen.c libhello.so
$(CC) -g main_dlopen.c -o hello_dlopen.exe -ldl
libhello.so: hello_lib.c
$(CC) -g -fopenmp -shared hello_lib.c -fPIC -o libhello.so
clean:
rm hello.exe hello_lib.exe hello_dlopen.exe libhello.so
\ No newline at end of file
#include <omp.h>
#include <stdio.h>
//#include "callback.h"
#define THREADS 4
void hello(){
#pragma omp parallel num_threads(THREADS)
{
printf("Hello from Thread %i of %i\n", omp_get_thread_num(), omp_get_num_threads());
}
}
\ No newline at end of file
#include <omp.h>
#include <stdio.h>
#define THREADS 4
int main(int argc, char** argv){
#pragma omp parallel num_threads(THREADS)
{
printf("Hello from Thread %i of %i\n", omp_get_thread_num(), omp_get_num_threads());
}
}
\ No newline at end of file
#include <omp.h>
#include <stdio.h>
#include <dlfcn.h>
#define THREADS 4
int main(int argc, char** argv){
void* h = dlopen("libhello.so", RTLD_LAZY);
void (*test)() = dlsym(h, "hello");
test();
}
#include <omp.h>
#include <stdio.h>
//#include "callback.h"
#define THREADS 4
void hello();
int main(int argc, char** argv){
hello();
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment