Commit 652d8bf3 authored by breuera's avatar breuera

Added SCons build option for OpenGL visualization.

parent bf95cd30
...@@ -76,6 +76,8 @@ vars.AddVariables( ...@@ -76,6 +76,8 @@ vars.AddVariables(
allowed_values=('sm_20', 'sm_21', 'sm_22', 'sm_23') allowed_values=('sm_20', 'sm_21', 'sm_22', 'sm_23')
), ),
BoolVariable( 'openGL', 'compile with OpenGL visualization', False),
BoolVariable( 'writeNetCDF', 'write output in the netCDF-format', False ), BoolVariable( 'writeNetCDF', 'write output in the netCDF-format', False ),
BoolVariable( 'asagi', 'use ASAGI', False ), BoolVariable( 'asagi', 'use ASAGI', False ),
...@@ -93,6 +95,7 @@ vars.AddVariables( ...@@ -93,6 +95,7 @@ vars.AddVariables(
PathVariable( 'linkerPath', 'location of the C++ linker', None, PathVariable.PathIsFile ), PathVariable( 'linkerPath', 'location of the C++ linker', None, PathVariable.PathIsFile ),
PathVariable( 'cudaToolkitDir', 'location of the CUDA toolkit', None ), PathVariable( 'cudaToolkitDir', 'location of the CUDA toolkit', None ),
PathVariable( 'cudaSDKDir', 'location of the CUDA SDK', None), PathVariable( 'cudaSDKDir', 'location of the CUDA SDK', None),
PathVariable( 'libSDLDir', 'location of libSDL', None),
PathVariable( 'netCDFDir', 'location of netCDF', None), PathVariable( 'netCDFDir', 'location of netCDF', None),
PathVariable( 'asagiDir', 'location of ASAGI', None), PathVariable( 'asagiDir', 'location of ASAGI', None),
PathVariable( 'libxmlDir', 'location of libxml2', None) PathVariable( 'libxmlDir', 'location of libxml2', None)
...@@ -122,6 +125,11 @@ if env['parallelization'] in ['cuda', 'mpi_with_cuda'] and env['solver'] != 'rus ...@@ -122,6 +125,11 @@ if env['parallelization'] in ['cuda', 'mpi_with_cuda'] and env['solver'] != 'rus
print '** The "'+env['solver']+'" solver is not supported in CUDA.' print '** The "'+env['solver']+'" solver is not supported in CUDA.'
Exit(1) Exit(1)
# CUDA parallelization for openGL
if env['parallelization'] != 'cuda' and env['openGL'] == True:
print '** The parallelization "'+env['parallelization']+'" does not support OpenGL visualization (CUDA only).'
Exit(1)
# #
# precompiler, compiler and linker flags # precompiler, compiler and linker flags
# #
...@@ -196,6 +204,14 @@ if env['parallelization'] in ['mpi_with_cuda', 'mpi']: ...@@ -196,6 +204,14 @@ if env['parallelization'] in ['mpi_with_cuda', 'mpi']:
env['LINKERFORPROGRAMS'] = env['linkerPath'] env['LINKERFORPROGRAMS'] = env['linkerPath']
env['LINKERFORPROGRAMS'] = 'mpiCC' env['LINKERFORPROGRAMS'] = 'mpiCC'
if env['openGL'] == True:
env.Append(LIBS=['SDL', 'GLU'])
# set the compiler flags for libSDL
if 'libSDLDir' in env:
env.Append(CPPPATH=[env['libSDLDir']+'/include/SDL'])
env.Append(LIBPATH=[env['libSDLDir']+'/lib'])
# set the precompiler flags and includes for netCDF # set the precompiler flags and includes for netCDF
if env['writeNetCDF'] == True: if env['writeNetCDF'] == True:
env.Append(CPPDEFINES=['WRITENETCDF']) env.Append(CPPDEFINES=['WRITENETCDF'])
......
#! /usr/bin/python
# @file
# This file is part of SWE.
#
# @author Alexander Breuer (breuera AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Dipl.-Math._Alexander_Breuer)
#
# @section LICENSE
#
# SWE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# SWE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with SWE. If not, see <http://www.gnu.org/licenses/>.
#
#
# @section DESCRIPTION
#
# Example build parameters a "gnu, cuda, opengl" setting.
#
#build options
parallelization='cuda'
computeCapability='sm_21'
solver='fwave'
openGL='yes'
# libraries (machine dependent)
libSDLDir = '/work/breuera/software/libsdl/SDL-1.2.14'
cudaToolkitDir='/work/breuera/software/cuda'
cudaSDKDir='/work/breuera/workspace/NVIDIA_GPU_Computing_SDK'
...@@ -47,6 +47,8 @@ else: ...@@ -47,6 +47,8 @@ else:
sourceFiles.append( [ 'SWE_WavePropagationBlockCuda.cu', sourceFiles.append( [ 'SWE_WavePropagationBlockCuda.cu',
'SWE_WavePropagationBlockCuda_kernels.cu'] 'SWE_WavePropagationBlockCuda_kernels.cu']
) )
if env['openGL'] == True:
sourceFiles.append( ['opengl/simulation.cu'] )
# compile the files defined so far, important step because of possible different compilers # compile the files defined so far, important step because of possible different compilers
for i in sourceFiles: for i in sourceFiles:
...@@ -55,6 +57,15 @@ for i in sourceFiles: ...@@ -55,6 +57,15 @@ for i in sourceFiles:
# SWE_Block is used in every implementation # SWE_Block is used in every implementation
sourceFiles = ['SWE_Block.cpp'] sourceFiles = ['SWE_Block.cpp']
# OpenGL CPU-files
if env['openGL'] == True:
sourceFiles.append( ['scenarios/SWE_VtkScenario.cpp'] )
sourceFiles.append( ['scenarios/SWE_VtkScenarioVisInfo.cpp'] )
sourceFiles.append( ['opengl/camera.cpp'] )
sourceFiles.append( ['opengl/controller.cpp'] )
sourceFiles.append( ['opengl/shader.cpp'] )
sourceFiles.append( ['opengl/visualization.cpp'] )
# netCDF writer # netCDF writer
if env['writeNetCDF'] == True: if env['writeNetCDF'] == True:
sourceFiles.append( ['tools/NetCdfWriter.cpp'] ) sourceFiles.append( ['tools/NetCdfWriter.cpp'] )
...@@ -66,7 +77,10 @@ if env['xmlRuntime'] == True: ...@@ -66,7 +77,10 @@ if env['xmlRuntime'] == True:
# file containing the main-function # file containing the main-function
if env['parallelization'] in ['none', 'cuda']: if env['parallelization'] in ['none', 'cuda']:
if env['solver'] != 'rusanov': if env['solver'] != 'rusanov':
sourceFiles.append( ['examples/swe_wavepropagation.cpp'] ) if env['openGL'] == False:
sourceFiles.append( ['examples/swe_wavepropagation.cpp'] )
else:
sourceFiles.append( ['examples/swe_opengl.cpp'] )
else: else:
print '** The selected configuration is not implemented.' print '** The selected configuration is not implemented.'
Exit(1) Exit(1)
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "../scenarios/SWE_VtkScenarioVisInfo.h" #include "../scenarios/SWE_VtkScenarioVisInfo.h"
#include "../SWE_BlockCUDA.hh" #include "../SWE_BlockCUDA.hh"
// #include "../SWE_RusanovBlockCUDA.hh" // #include "../SWE_RusanovBlockCUDA.hh"
#include "../SWE_WavePropagationBlockCUDA.hh" #include "../SWE_WavePropagationBlockCuda.hh"
// For SDL compatibility // For SDL compatibility
#undef main #undef main
......
Markdown is supported
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