Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix target directory so that it can compile properly without linking in fopenmp #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion target/offload.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <cassert>
#include <cstdio>
#include <cstring>
#include <omp.h>
#include "openmp.h"
#include "util.h"

inline const char *get_variant_string()
Expand Down
18 changes: 14 additions & 4 deletions target/openmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,23 @@ OpenMP wrapper for headerfile
#ifdef _OPENMP
#include <omp.h>
#else
inline int omp_get_thread_num() { return 0; }
inline int omp_get_max_threads() { return 1; }
inline void omp_set_num_threads(int num_threads) { return 1; }
inline int __sync_fetch_and_add(int *ptr, int value)

#ifndef OPENMP_H
#define OPENMP_H

inline int omp_get_thread_num() { return 0; }
inline int omp_get_max_threads() { return 1; }
inline void omp_set_num_threads(int num_threads) { ; }
inline int omp_get_num_teams(void) { return 1; }
inline int omp_get_team_num(void) { return 0; }
inline int omp_is_initial_device(void) { return 1; }
inline int __sync_fetch_and_add(int *ptr, int value)
{
int tmp = *ptr;
ptr[0] += value;
return tmp;
}

#endif

#endif
2 changes: 1 addition & 1 deletion target/thermo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "stdio.h"
#include "stdlib.h"
#include "util.h"
#include <omp.h>
#include "openmp.h"

Thermo::Thermo() {}
Thermo::~Thermo() {}
Expand Down