Commit a0069db3 authored by Tomas Sobotik's avatar Tomas Sobotik
Browse files

Alpha version of parallel solver.

parent fec4c09b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3,3 +3,4 @@ add_subdirectory( simple-solver )
add_subdirectory( heat-equation )
add_subdirectory( navier-stokes )
add_subdirectory( hamilton-jacobi )
add_subdirectory( hamilton-jacobi-parallel )
+17 −0
Original line number Diff line number Diff line
set( tnl_hamilton_jacobi_parallel_SOURCES
     MainBuildConfig.h
     tnlParallelEikonalSolver_impl.h
     tnlParallelEikonalSolver.h
     main.cpp
     parallelEikonalConfig.h )
               
ADD_EXECUTABLE(hamilton-jacobi-parallel${debugExt} main.cpp)
target_link_libraries (hamilton-jacobi-parallel${debugExt} tnl${debugExt}-${tnlVersion} )

INSTALL( TARGETS hamilton-jacobi-parallel${debugExt}
         RUNTIME DESTINATION bin
         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )
        
INSTALL( FILES ${tnl_hamilton_jacobi_parallel_SOURCES}
               Makefile
         DESTINATION share/tnl-${tnlVersion}/examples/hamilton-jacobi-parallel )
+64 −0
Original line number Diff line number Diff line
/***************************************************************************
                          MainBuildConfig.h  -  description
                             -------------------
    begin                : Jul 7, 2014
    copyright            : (C) 2014 by Tomas Oberhuber
    email                : tomas.oberhuber@fjfi.cvut.cz
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program 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 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef MAINBUILDCONFIG_H_
#define MAINBUILDCONFIG_H_

#include <solvers/tnlConfigTags.h>

class MainBuildConfig
{
   public:

      static void print() { cerr << "MainBuildConfig" << endl; }
};

/****
 * Turn off support for float and long double.
 */
template<> struct tnlConfigTagReal< MainBuildConfig, float > { enum { enabled = false }; };
template<> struct tnlConfigTagReal< MainBuildConfig, long double > { enum { enabled = false }; };

/****
 * Turn off support for short int and long int indexing.
 */
template<> struct tnlConfigTagIndex< MainBuildConfig, short int >{ enum { enabled = false }; };
template<> struct tnlConfigTagIndex< MainBuildConfig, long int >{ enum { enabled = false }; };

/****
 * Use of tnlGrid is enabled for allowed dimensions and Real, Device and Index types.
 */
template< int Dimensions, typename Real, typename Device, typename Index >
   struct tnlConfigTagMesh< MainBuildConfig, tnlGrid< Dimensions, Real, Device, Index > >
      { enum { enabled = tnlConfigTagDimensions< MainBuildConfig, Dimensions >::enabled  &&
                         tnlConfigTagReal< MainBuildConfig, Real >::enabled &&
                         tnlConfigTagDevice< MainBuildConfig, Device >::enabled &&
                         tnlConfigTagIndex< MainBuildConfig, Index >::enabled }; };

/****
 * Please, chose your preferred time discretisation  here.
 */
template<> struct tnlConfigTagTimeDiscretisation< MainBuildConfig, tnlExplicitTimeDiscretisationTag >{ enum { enabled = true }; };
template<> struct tnlConfigTagTimeDiscretisation< MainBuildConfig, tnlSemiImplicitTimeDiscretisationTag >{ enum { enabled = false}; };
template<> struct tnlConfigTagTimeDiscretisation< MainBuildConfig, tnlImplicitTimeDiscretisationTag >{ enum { enabled = false }; };

/****
 * Only the Runge-Kutta-Merson solver is enabled by default.
 */
template<> struct tnlConfigTagExplicitSolver< MainBuildConfig, tnlExplicitEulerSolverTag >{ enum { enabled = false }; };

#endif /* MAINBUILDCONFIG_H_ */
+41 −0
Original line number Diff line number Diff line
TNL_VERSION=0.1
TNL_INSTALL_DIR=${HOME}/local/lib
TNL_INCLUDE_DIR=${HOME}/local/include/tnl-${TNL_VERSION}

TARGET = hamiltonJacobiParallelSolver
#CONFIG_FILE = $(TARGET).cfg.desc
INSTALL_DIR = ${HOME}/local
CXX = g++
CUDA_CXX = nvcc
OMP_FLAGS = -DHAVE_OPENMP -fopenmp
CXX_FLAGS = -std=gnu++0x -I$(TNL_INCLUDE_DIR) -O3 $(OMP_FLAGS)
LD_FLAGS = -L$(TNL_INSTALL_DIR) -ltnl-0.1 -lgomp

SOURCES = main.cpp
HEADERS = 
OBJECTS = main.o
DIST = $(SOURCES) Makefile

all: $(TARGET)
clean: 
	rm -f $(OBJECTS)
	rm -f $(TARGET)-conf.h	

dist: $(DIST)
	tar zcvf $(TARGET).tgz $(DIST) 

install: $(TARGET)
	cp $(TARGET) $(INSTALL_DIR)/bin
	cp $(CONFIG_FILE) $(INSTALL_DIR)/share

uninstall: $(TARGET)
	rm -f $(INSTALL_DIR)/bin/$(TARGET) 
	rm -f $(CONFIG_FILE) $(INSTALL_DIR)/share

$(TARGET): $(OBJECTS)
	$(CXX) -o $(TARGET) $(OBJECTS) $(LD_FLAGS)

%.o: %.cpp $(HEADERS)
	$(CXX) -c -o $@ $(CXX_FLAGS) $<

+53 −0
Original line number Diff line number Diff line
/***************************************************************************
                          main.cpp  -  description
                             -------------------
    begin                : Jul 8 , 2014
    copyright            : (C) 2014 by Tomas Sobotik
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program 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 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include "tnlParallelEikonalSolver.h"
#include "parallelEikonalConfig.h"
#include "MainBuildConfig.h"
#include <solvers/tnlConfigTags.h>
#include <operators/godunov-eikonal/parallelGodunovEikonal.h>
#include <mesh/tnlGrid.h>

typedef MainBuildConfig BuildConfig;

int main( int argc, char* argv[] )
{
   tnlParameterContainer parameters;
   tnlConfigDescription configDescription;
   parallelEikonalConfig< BuildConfig >::configSetup( configDescription );

   if( ! ParseCommandLine( argc, argv, configDescription, parameters ) )
      return false;

   //if (parameters.GetParameter <tnlString>("scheme") == "godunov")
   //{
	   typedef parallelGodunovEikonalScheme< tnlGrid<2,double,tnlHost, int>, double, int > SchemeType;
   	   tnlParallelEikonalSolver<SchemeType> solver;
   	   if(!solver.init(parameters))
   	   {
   		   cerr << "Solver failed to initialize." << endl;
   		   return EXIT_FAILURE;
   	   }
   	   cout << "-------------------------------------------------------------" << endl;
   	   cout << "Starting solver loop..." << endl;
   	   solver.run();
   	   cout << "a" <<endl;
  // }

   return EXIT_SUCCESS;
}

Loading