Loading buildAll +0 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ CUDA_ARCHITECTURE=2.0 VERBOSE=1 CPUS=`grep -c processor /proc/cpuinfo` CPUS=1 echo "Building $TARGET using $CPUS processors." Loading examples/make-project/Makefile +26 −15 Original line number Diff line number Diff line TNL_VERSION="0.1" TNL_VERSION=0.1 TNL_INSTALL_DIR=${HOME}/local/lib TNL_INCLUDE_DIR=${HOME}/local/include/tnl-${TNL_VERSION} TARGET = program-name CONFIG_FILE = $(TARGET).cfg.desc INSTALL_DIR = ${HOME}/local CXX = g++ CUDA_CXX = nvcc CXX_FLAGS = -std=gnu++0x -I${TNL_INCLUDE_DIR} LD_FLAGS = -L${TNL_INSTALL_DIR} -ltnl-0.1 CXX_FLAGS = -std=gnu++0x -I$(TNL_INCLUDE_DIR) LD_FLAGS = -L$(TNL_INSTALL_DIR) -ltnl-0.1 OBJECTS = Finite_Elements.o MatrixStorage/CSRMatrix.o MatrixStorage/objVector.o ParameterContainer/parameterContainer.o DIST = main.cpp Makefile SOURCES = main.cpp HEADERS = OBJECTS = main.o DIST = $(SOURCES) Makefile all: prog all: $(TARGET) clean: rm -f $(OBJECTS) rm -f $(TARGET)-conf.h dist: $(DIST) tar zcvf prog.tgz $(DIST) tar zcvf $(TARGET).tgz $(DIST) install: prog mv prog $(PROG) install: $(TARGET) cp $(TARGET) $(INSTALL_DIR)/bin cp $(CONFIG_FILE) $(INSTALL_DIR)/share uninstall: prog rm f /usr/local/bin uninstall: $(TARGET) rm -f $(INSTALL_DIR)/bin/$(TARGET) rm -f $(CONFIG_FILE) $(INSTALL_DIR)/share prog: $(OBJECTS) $(CC) -o prog $(OBJECTS) $(LD_FLAGS) $(TARGET): $(OBJECTS) $(CC) -o $(TARGET) $(OBJECTS) $(LD_FLAGS) %.o: %.cpp %.o: %.cpp $(TARGET)-conf.h $(HEADERS) $(CC) -c -o $@ $(CXX_FLAGS) $< $(TARGET)-conf.h: echo "#define CONFIG_FILE \"${INSTALL_DIR}/share/${CONFIG_FILE}\" " > $(TARGET)-conf.h examples/make-project/main.cpp 0 → 100644 +41 −0 Original line number Diff line number Diff line /*************************************************************************** main.cpp - description ------------------- begin : Jan 12, 2013 copyright : (C) 2013 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. * * * ***************************************************************************/ #include "two-phase-flow.h" #include "program-name-conf.h" #include <config/tnlConfigDescription.h> #include <config/tnlParameterContainer.h> int main( int argc, char* argv[] ) { tnlParameterContainer parameters; tnlConfigDescription conf_desc; if( conf_desc. ParseConfigDescription( CONFIG_FILE ) != 0 ) return EXIT_FAILURE; if( ! ParseCommandLine( argc, argv, conf_desc, parameters ) ) { conf_desc. PrintUsage( argv[ 0 ] ); return EXIT_FAILURE; } /**** * Write your code here */ return EXIT_SUCCESS; } examples/make-project/program-name.cfg.desc 0 → 100644 +22 −0 Original line number Diff line number Diff line group IO { string input-file [Input file name.]; string output-file [Output file name.]; real output-period [Intervals for writing the state of the computation (in the meaning of parameter t).]; },[Arguments describing input and output data.]; group Problem { real final-t(!) [When reaching this t the computation will stop.]; },[Setting up the problem we solve.]; group Method { string method(!) [Method for solving the problem.]; },[Parameters controling the method we use.]; group Solver { string solver-name; real max-solver-res( 1.0e-6 ); integer max-solver-iterations( 1000000 ); },[Parameters of the solver]; src/core/tnlTimerCPU.cpp +53 −1 Original line number Diff line number Diff line Loading @@ -19,4 +19,56 @@ tnlTimerCPU default_mcore_cpu_timer; tnlTimerCPU :: tnlTimerCPU() { Reset(); } //-------------------------------------------------------------------------- void tnlTimerCPU :: Reset() { #ifdef HAVE_SYS_RESOURCE_H rusage init_usage; getrusage( RUSAGE_SELF, &init_usage ); initial_time = init_usage. ru_utime. tv_sec + 1.0e-6 * ( double ) init_usage. ru_utime. tv_usec; #else initial_time = 0; #endif total_time = 0.0; stop_state = false; } //-------------------------------------------------------------------------- void tnlTimerCPU :: Stop() { #ifdef HAVE_SYS_RESOURCE_H if( ! stop_state ) { rusage init_usage; getrusage( RUSAGE_SELF, &init_usage ); total_time += init_usage. ru_utime. tv_sec + 1.0e-6 * ( double ) init_usage. ru_utime. tv_usec - initial_time; stop_state = true; } #endif } //-------------------------------------------------------------------------- void tnlTimerCPU :: Continue() { #ifdef HAVE_SYS_RESOURCE_H rusage init_usage; getrusage( RUSAGE_SELF, &init_usage ); initial_time = init_usage. ru_utime. tv_sec + 1.0e-6 * ( double ) init_usage. ru_utime. tv_usec; #endif stop_state = false; } //-------------------------------------------------------------------------- double tnlTimerCPU :: GetTime( int root, MPI_Comm comm ) { #ifdef HAVE_SYS_RESOURCE_H Stop(); Continue(); double mpi_total_time; MPIReduce( total_time, mpi_total_time, 1, MPI_SUM, root, comm ); return mpi_total_time; #else return -1; #endif } Loading
buildAll +0 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ CUDA_ARCHITECTURE=2.0 VERBOSE=1 CPUS=`grep -c processor /proc/cpuinfo` CPUS=1 echo "Building $TARGET using $CPUS processors." Loading
examples/make-project/Makefile +26 −15 Original line number Diff line number Diff line TNL_VERSION="0.1" TNL_VERSION=0.1 TNL_INSTALL_DIR=${HOME}/local/lib TNL_INCLUDE_DIR=${HOME}/local/include/tnl-${TNL_VERSION} TARGET = program-name CONFIG_FILE = $(TARGET).cfg.desc INSTALL_DIR = ${HOME}/local CXX = g++ CUDA_CXX = nvcc CXX_FLAGS = -std=gnu++0x -I${TNL_INCLUDE_DIR} LD_FLAGS = -L${TNL_INSTALL_DIR} -ltnl-0.1 CXX_FLAGS = -std=gnu++0x -I$(TNL_INCLUDE_DIR) LD_FLAGS = -L$(TNL_INSTALL_DIR) -ltnl-0.1 OBJECTS = Finite_Elements.o MatrixStorage/CSRMatrix.o MatrixStorage/objVector.o ParameterContainer/parameterContainer.o DIST = main.cpp Makefile SOURCES = main.cpp HEADERS = OBJECTS = main.o DIST = $(SOURCES) Makefile all: prog all: $(TARGET) clean: rm -f $(OBJECTS) rm -f $(TARGET)-conf.h dist: $(DIST) tar zcvf prog.tgz $(DIST) tar zcvf $(TARGET).tgz $(DIST) install: prog mv prog $(PROG) install: $(TARGET) cp $(TARGET) $(INSTALL_DIR)/bin cp $(CONFIG_FILE) $(INSTALL_DIR)/share uninstall: prog rm f /usr/local/bin uninstall: $(TARGET) rm -f $(INSTALL_DIR)/bin/$(TARGET) rm -f $(CONFIG_FILE) $(INSTALL_DIR)/share prog: $(OBJECTS) $(CC) -o prog $(OBJECTS) $(LD_FLAGS) $(TARGET): $(OBJECTS) $(CC) -o $(TARGET) $(OBJECTS) $(LD_FLAGS) %.o: %.cpp %.o: %.cpp $(TARGET)-conf.h $(HEADERS) $(CC) -c -o $@ $(CXX_FLAGS) $< $(TARGET)-conf.h: echo "#define CONFIG_FILE \"${INSTALL_DIR}/share/${CONFIG_FILE}\" " > $(TARGET)-conf.h
examples/make-project/main.cpp 0 → 100644 +41 −0 Original line number Diff line number Diff line /*************************************************************************** main.cpp - description ------------------- begin : Jan 12, 2013 copyright : (C) 2013 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. * * * ***************************************************************************/ #include "two-phase-flow.h" #include "program-name-conf.h" #include <config/tnlConfigDescription.h> #include <config/tnlParameterContainer.h> int main( int argc, char* argv[] ) { tnlParameterContainer parameters; tnlConfigDescription conf_desc; if( conf_desc. ParseConfigDescription( CONFIG_FILE ) != 0 ) return EXIT_FAILURE; if( ! ParseCommandLine( argc, argv, conf_desc, parameters ) ) { conf_desc. PrintUsage( argv[ 0 ] ); return EXIT_FAILURE; } /**** * Write your code here */ return EXIT_SUCCESS; }
examples/make-project/program-name.cfg.desc 0 → 100644 +22 −0 Original line number Diff line number Diff line group IO { string input-file [Input file name.]; string output-file [Output file name.]; real output-period [Intervals for writing the state of the computation (in the meaning of parameter t).]; },[Arguments describing input and output data.]; group Problem { real final-t(!) [When reaching this t the computation will stop.]; },[Setting up the problem we solve.]; group Method { string method(!) [Method for solving the problem.]; },[Parameters controling the method we use.]; group Solver { string solver-name; real max-solver-res( 1.0e-6 ); integer max-solver-iterations( 1000000 ); },[Parameters of the solver];
src/core/tnlTimerCPU.cpp +53 −1 Original line number Diff line number Diff line Loading @@ -19,4 +19,56 @@ tnlTimerCPU default_mcore_cpu_timer; tnlTimerCPU :: tnlTimerCPU() { Reset(); } //-------------------------------------------------------------------------- void tnlTimerCPU :: Reset() { #ifdef HAVE_SYS_RESOURCE_H rusage init_usage; getrusage( RUSAGE_SELF, &init_usage ); initial_time = init_usage. ru_utime. tv_sec + 1.0e-6 * ( double ) init_usage. ru_utime. tv_usec; #else initial_time = 0; #endif total_time = 0.0; stop_state = false; } //-------------------------------------------------------------------------- void tnlTimerCPU :: Stop() { #ifdef HAVE_SYS_RESOURCE_H if( ! stop_state ) { rusage init_usage; getrusage( RUSAGE_SELF, &init_usage ); total_time += init_usage. ru_utime. tv_sec + 1.0e-6 * ( double ) init_usage. ru_utime. tv_usec - initial_time; stop_state = true; } #endif } //-------------------------------------------------------------------------- void tnlTimerCPU :: Continue() { #ifdef HAVE_SYS_RESOURCE_H rusage init_usage; getrusage( RUSAGE_SELF, &init_usage ); initial_time = init_usage. ru_utime. tv_sec + 1.0e-6 * ( double ) init_usage. ru_utime. tv_usec; #endif stop_state = false; } //-------------------------------------------------------------------------- double tnlTimerCPU :: GetTime( int root, MPI_Comm comm ) { #ifdef HAVE_SYS_RESOURCE_H Stop(); Continue(); double mpi_total_time; MPIReduce( total_time, mpi_total_time, 1, MPI_SUM, root, comm ); return mpi_total_time; #else return -1; #endif }