Skip to content

Commit

Permalink
enable openmp for apple clang compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
xLPMG committed Jan 9, 2024
1 parent b1248e5 commit 51ee65b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
15 changes: 12 additions & 3 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,23 @@ if 'report' in env['report']:
# OPENMP #
#####################
if 'gnu' in env['omp']:
env.Append( CXXFLAGS = [ '-fopenmp' ] )
env.Append( LINKFLAGS = [ '-fopenmp' ] )
env.Append( CXXFLAGS = [ '-DUSEOMP' ] )
if OS == "Darwin":
env.Append( CXXFLAGS = [ '-Xpreprocessor', '-fopenmp' ] )
env.Append( LINKFLAGS = [ '-Xpreprocessor', '-fopenmp' ] )
env.Append( CXXFLAGS = [ '-DUSEOMP' ] )
else:
env.Append( CXXFLAGS = [ '-fopenmp' ] )
env.Append( LINKFLAGS = [ '-fopenmp' ] )
env.Append( CXXFLAGS = [ '-DUSEOMP' ] )
if 'intel' in env['omp']:
env.Append( CXXFLAGS = [ '-qopenmp' ] )
env.Append( LINKFLAGS = [ '-qopenmp' ] )
env.Append( CXXFLAGS = [ '-DUSEOMP' ] )

if OS == "Darwin":
env.Append( CXXFLAGS = [ '-I/usr/local/opt/libomp/include' ] )
env.Append( LINKFLAGS = [ '-L/usr/local/opt/libomp/lib' ] )
env.Append( LINKFLAGS = [ '-lomp' ] )
#####################
# SANITIZERS #
#####################
Expand Down
10 changes: 7 additions & 3 deletions src/Launcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
#ifndef TSUNAMI_LAB_LAUNCHER_H
#define TSUNAMI_LAB_LAUNCHER_H

#ifdef USEOMP
#include <omp.h>
#endif

// waveprop patches
#include "patches/WavePropagation1d.h"
#include "patches/WavePropagation2d.h"
Expand Down Expand Up @@ -84,7 +88,7 @@ class tsunami_lab::Launcher

// simulation parameters
std::string m_solver = "";
tsunami_lab::patches::WavePropagation *m_waveProp = nullptr;
tsunami_lab::patches::WavePropagation *m_waveProp;
tsunami_lab::t_idx m_nx = 0;
tsunami_lab::t_idx m_ny = 0;
tsunami_lab::t_idx m_nk = 1;
Expand Down Expand Up @@ -213,8 +217,8 @@ class tsunami_lab::Launcher
//-----------------GETTERS------------------//
//------------------------------------------//

void getWaveProp(tsunami_lab::patches::WavePropagation &o_waveprop){
o_waveprop = *m_waveProp;
tsunami_lab::patches::WavePropagation *getWaveProp(){
return m_waveProp;
}

void getSetupChoice(std::string &o_setupChoice){
Expand Down

0 comments on commit 51ee65b

Please sign in to comment.