Commit 6c0f5564 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Moving and merging from RavenDistributedInterface and RavenNet

parent f5caee9c
......@@ -10,7 +10,9 @@ set( ITA_SIMULATION_SCHEDULER_COMMON_BUILD TRUE )
# general dependencies
vista_use_package( ITABase REQUIRED FIND_DEPENDENCIES )
vista_use_package( VistaCoreLibs REQUIRED VistaBase VistaMath VistaInterProcComm )
vista_use_package( tbb REQUIRED )
vista_find_package( MPI OPTIONAL QUIET )
vista_find_package( RavenSimulationCore OPTIONAL QUIET )
# configuration
......@@ -27,12 +29,46 @@ if( NOT DEFINED ITA_SIMULATION_SCHEDULER_BENCHMARKS )
endif( )
if( NOT DEFINED ITA_SIMULATION_SCHEDULER_RAVEN_MODULE )
set( ITA_SIMULATION_SCHEDULER_RAVEN_MODULE OFF CACHE BOOL "Build RAVEN scheduler workers and applications for distributed computing" )
set( ITA_SIMULATION_SCHEDULER_RAVEN_MODULE ON CACHE BOOL "Build RAVEN scheduler workers and applications for distributed computing" )
endif( )
# resolve further dependencies
# Raven specifics
if( ITA_SIMULATION_SCHEDULER_RAVEN_MODULE )
vista_use_package( RAVEN REQUIRED FIND_DEPENDENCIES )
if( NOT ITA_RAVENNET_SERVER_VERBOSE )
set( ITA_RAVENNET_SERVER_VERBOSE OFF CACHE BOOL "Activate RavenNet verbose output on server side" )
mark_as_advanced( ITA_RAVENNET_SERVER_VERBOSE )
endif( )
if( NOT ITA_RAVENNET_SERVER_SHOW_RAW_TRAFFIC )
set( ITA_RAVENNET_SERVER_SHOW_RAW_TRAFFIC OFF CACHE BOOL "Activate RavenNet show raw traffic on server side (for debugging)" )
mark_as_advanced( ITA_RAVENNET_SERVER_SHOW_RAW_TRAFFIC )
endif( )
add_definitions( -DRAVEN_LOG_LEVEL=${ITA_RAVEN_DEFAULT_LOG_LEVEL} )
vista_use_package( RavenDeclarations REQUIRED FIND_DEPENDENCIES )
vista_use_package( RavenGeo REQUIRED FIND_DEPENDENCIES )
vista_use_package( RavenSimulationCore REQUIRED FIND_DEPENDENCIES )
if( NOT WIN32 )
add_definitions( "-std=gnu++11" )
add_definitions( "-Wno-deprecated" )
endif( )
if( ITA_RAVENNET_SERVER_VERBOSE )
add_definitions( -DRAVENNET_SERVER_VERBOSE )
endif( )
if( ITA_RAVENNET_SERVER_SHOW_RAW_TRAFFIC )
add_definitions( -DRAVENNET_SERVER_SHOW_RAW_TRAFFIC )
endif( )
# Deploy
install( DIRECTORY "examples/Raven" DESTINATION "." )
endif( )
......@@ -74,7 +110,7 @@ target_link_libraries( ITASimulationScheduler ${VISTA_USE_PACKAGE_LIBRARIES} )
# config
vista_configure_lib( ITASimulationScheduler )
vista_install( ITASimulationScheduler )
set( ITAGEO_INCLUDE_OUTDIR "${CMAKE_CURRENT_SOURCE_DIR}/include" )
set( ITASIMULATIONSCHEDULER_INCLUDE_OUTDIR "${CMAKE_CURRENT_SOURCE_DIR}/include" )
vista_create_cmake_configs( ITASimulationScheduler )
vista_create_default_info_file( ITASimulationScheduler )
......@@ -87,7 +123,13 @@ if( ITA_SIMULATION_SCHEDULER_APPS )
add_subdirectory( "apps" )
if( ITA_SIMULATION_SCHEDULER_RAVEN_MODULE )
add_subdirectory( "apps/raven" )
add_subdirectory( "apps/raven/ravenegg" )
add_subdirectory( "apps/raven/ravennest" )
if( VMPI_FOUND )
add_subdirectory( "apps/raven/unkindness" )
endif( VMPI_FOUND )
endif( )
endif( )
......@@ -99,7 +141,20 @@ if( ITA_SIMULATION_SCHEDULER_TESTS )
add_subdirectory( "tests" )
if( ITA_SIMULATION_SCHEDULER_RAVEN_MODULE )
add_subdirectory( "tests/raven" )
add_subdirectory( "tests/raven/RavenNetSchedulerTest" )
add_subdirectory( "tests/raven/RavenNetTestClient" )
add_subdirectory( "tests/raven/RavenNetTestServer" )
add_subdirectory( "tests/raven/RavenSimulationServerTest" )
add_subdirectory( "tests/raven/RavenTest" )
add_subdirectory( "tests/raven/Tiny" )
add_subdirectory( "tests/raven/VistaNetTest" )
if( VMPI_FOUND )
add_subdirectory( "tests/raven/LinuxRavenClusterNodeTest" )
add_subdirectory( "tests/raven/RavenMPICluster" )
endif( )
add_subdirectory( "tests/raven/OpenMPTest" )
endif( )
endif( )
......@@ -108,10 +163,12 @@ endif( )
# benchmarks
if( ITA_SIMULATION_SCHEDULER_BENCHMARKS )
add_subdirectory( "benchmarks" )
#add_subdirectory( "benchmarks" ) # empty yet
if( ITA_SIMULATION_SCHEDULER_RAVEN_MODULE )
add_subdirectory( "benchmarks/raven" )
add_subdirectory( "benchmarks/raven/AddTask" )
add_subdirectory( "benchmarks/raven/DummyServer" )
add_subdirectory( "benchmarks/raven/Scheduler" )
endif( )
endif( )
......@@ -17,4 +17,4 @@ vista_set_target_msvc_arguments( simsched_cli "localhost:12350" )
vista_configure_app( simsched_cli )
vista_install( simsched_cli )
vista_create_default_info_file( simsched_cli )
set_property( TARGET simsched_cli PROPERTY FOLDER "ITASimulationSchedulerTest/Apps" )
set_property( TARGET simsched_cli PROPERTY FOLDER "ITASimulationScheduler/Apps" )
cmake_minimum_required( VERSION 2.8 )
project( ravenegg )
list( APPEND CMAKE_MODULE_PATH "$ENV{VISTA_CMAKE_COMMON}" )
include( VistaCommon )
vista_use_package( ITASimulationScheduler REQUIRED FIND_DEPENDENCIES )
vista_use_package( ITABase REQUIRED FIND_DEPENDENCIES )
vista_use_package( RavenGeo REQUIRED FIND_DEPENDENCIES )
if( NOT DEFINED ITA_RAVEN_DATA_PATH )
message( WARNING "Raven data base path not set, but is highly recommended for ragenegg application (otherwise important files will not be found)" )
endif( )
set( ProjectSources "getopt.c" "getopt.h" "ravenegg.cpp" )
add_executable( ravenegg ${ProjectSources} )
target_link_libraries( ravenegg ${VISTA_USE_PACKAGE_LIBRARIES} )
vista_set_target_msvc_arguments( ravenegg "-t ${RAVENDISTRIBUTEDCOMPUTINGINTERFACE_ROOT_DIR}/examples/simple_room.rtask -d ${RAVENDISTRIBUTEDCOMPUTINGINTERFACE_ROOT_DIR}/examples -r ${RAVENDISTRIBUTEDCOMPUTINGINTERFACE_ROOT_DIR}/examples/simple_room.brir.wav" )
vista_configure_app( ravenegg )
vista_install( ravenegg )
vista_create_default_info_file( ravenegg )
set_property( TARGET ravenegg PROPERTY FOLDER "ITASimulationScheduler/Apps/Raven" )
if( WIN32 )
install( FILES "run_ravenegg_example.bat" DESTINATION "." )
else( )
install( FILES "run_ravenegg_example.sh" DESTINATION "." )
endif( )
This diff is collapsed.
/* getopt.h */
/* Declarations for getopt.
Copyright (C) 1989-1994, 1996-1999, 2001 Free Software
Foundation, Inc. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute
it and/or modify it under the terms of the GNU Lesser
General Public License as published by the Free Software
Foundation; either version 2.1 of the License, or
(at your option) any later version.
The GNU C Library 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 Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General
Public License along with the GNU C Library; if not, write
to the Free Software Foundation, Inc., 59 Temple Place,
Suite 330, Boston, MA 02111-1307 USA. */
#ifndef _GETOPT_H
#ifndef __need_getopt
# define _GETOPT_H 1
#endif
/* If __GNU_LIBRARY__ is not already defined, either we are being used
standalone, or this is the first header included in the source file.
If we are being used with glibc, we need to include <features.h>, but
that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
not defined, include <ctype.h>, which will pull in <features.h> for us
if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
doesn't flood the namespace with stuff the way some other headers do.) */
#if !defined __GNU_LIBRARY__
# include <ctype.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
extern char *optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns -1, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
extern int optind;
/* Callers store zero here to inhibit the error message `getopt' prints
for unrecognized options. */
extern int opterr;
/* Set to an option character which was unrecognized. */
extern int optopt;
#ifndef __need_getopt
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
of `struct option' terminated by an element containing a name which is
zero.
The field `has_arg' is:
no_argument (or 0) if the option does not take an argument,
required_argument (or 1) if the option requires an argument,
optional_argument (or 2) if the option takes an optional argument.
If the field `flag' is not NULL, it points to a variable that is set
to the value given in the field `val' when the option is found, but
left unchanged if the option is not found.
To have a long-named option do something other than set an `int' to
a compiled-in constant, such as set a value from `optarg', set the
option's `flag' field to zero and its `val' field to a nonzero
value (the equivalent single-letter option character, if there is
one). For long options that have a zero `flag' field, `getopt'
returns the contents of the `val' field. */
struct option
{
# if (defined __STDC__ && __STDC__) || defined __cplusplus
const char *name;
# else
char *name;
# endif
/* has_arg can't be an enum because some compilers complain about
type mismatches in all the code that assumes it is an int. */
int has_arg;
int *flag;
int val;
};
/* Names for the values of the `has_arg' field of `struct option'. */
# define no_argument 0
# define required_argument 1
# define optional_argument 2
#endif /* need getopt */
/* Get definitions and prototypes for functions to process the
arguments in ARGV (ARGC of them, minus the program name) for
options given in OPTS.
Return the option character from OPTS just read. Return -1 when
there are no more options. For unrecognized options, or options
missing arguments, `optopt' is set to the option letter, and '?' is
returned.
The OPTS string is a list of characters which are recognized option
letters, optionally followed by colons, specifying that that letter
takes an argument, to be placed in `optarg'.
If a letter in OPTS is followed by two colons, its argument is
optional. This behavior is specific to the GNU `getopt'.
The argument `--' causes premature termination of argument
scanning, explicitly telling `getopt' that there are no more
options.
If OPTS begins with `--', then non-option arguments are treated as
arguments to the option '\0'. This behavior is specific to the GNU
`getopt'. */
#if (defined __STDC__ && __STDC__) || defined __cplusplus
# ifdef __GNU_LIBRARY__
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts);
# else /* not __GNU_LIBRARY__ */
extern int getopt ();
# endif /* __GNU_LIBRARY__ */
# ifndef __need_getopt
extern int getopt_long (int ___argc, char *const *___argv,
const char *__shortopts,
const struct option *__longopts, int *__longind);
extern int getopt_long_only (int ___argc, char *const *___argv,
const char *__shortopts,
const struct option *__longopts, int *__longind);
/* Internal only. Users should not call this directly. */
extern int _getopt_internal (int ___argc, char *const *___argv,
const char *__shortopts,
const struct option *__longopts, int *__longind,
int __long_only);
# endif
#else /* not __STDC__ */
extern int getopt ();
# ifndef __need_getopt
extern int getopt_long ();
extern int getopt_long_only ();
extern int _getopt_internal ();
# endif
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
/* Make sure we later can get all the definitions and declarations. */
#undef __need_getopt
#endif /* getopt.h */
/*
* ----------------------------------------------------------------
*
* Room Acoustics for Virtual ENvironments (RAVEN)
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2013-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
* ravenegg
*
* Command line application to perform a simulation using
* a task input file to generate a result impulse response
*
*/
// getopt (simple command option parser)
#ifndef __GNU_LIBRARY__
#define __GNU_LIBRARY__
#endif
#include "getopt.h"
#include <ITASimulationScheduler//Raven/R_RavenSimulator.h>
#include <ITASimulationScheduler//Raven/R_RavenUtils.h>
#include <RG_Vector.h>
#include <ITAAudiofileWriter.h>
#include <ITAException.h>
#include <ITAFileSystemUtils.h>
#include <ITASampleFrame.h>
#include <ITAStopWatch.h>
#include <ITAStringUtils.h>
#include <VistaInterProcComm/Connections/VistaByteBufferSerializer.h>
#include <VistaInterProcComm/Connections/VistaByteBufferDeSerializer.h>
#include <iostream>
#include <memory>
#include <string>
#include <omp.h>
using namespace std;
void normalize_0dB( ITASampleFrame* );
void syntax_error()
{
cout << "Syntax: ravenegg -d DATABASEPATH -t TASKFILE -r RESULTFILE [-n (normalize)]" << endl;
cout << "Scene of task file may only include a single source and a single receiver" << endl;
}
int main( int argc, char* argv[] )
{
if( argc < 7 )
{
cout << "Too few arguments given (" << argc << ")" << endl;
syntax_error();
return 255;
}
string sRavenDataBasePath, sTaskPath, sResultPath;
bool bNormalize = false;
int c;
while( ( c = getopt( argc, argv, "d:nr:t:" ) ) != -1 )
{
switch( c )
{
case 'd':
sRavenDataBasePath = optarg;
break;
case 'n':
bNormalize = true;
break;
case 'r':
sResultPath = optarg;
break;
case 't':
sTaskPath = optarg;
break;
default:
char x = c;
string s = "1";
s[0] = x;
cout << "Parameter parse error, could not understand '" << s << "'" << endl;
syntax_error();
return 255;
}
}
if( doesDirectoryExist( sRavenDataBasePath ) == false )
{
cerr << "Given Raven data base path '" << sRavenDataBasePath << "' not found on this machine" << endl;
return 255;
}
try
{
cout << "Raven data base path is set to '" << sRavenDataBasePath << "'" << endl;
auto pRavenSimulator = std::make_shared< CRavenSimulator >( sRavenDataBasePath );
CRavenSimulationTask oTask;
CRavenSimulationResult oResult;
cout << "Loading task from file with path '" << sTaskPath << "'" << endl;
LoadTask( oTask, sTaskPath );
if( oTask.oScene.m_mSources.size() != 1 )
{
cerr << "[ERROR] Please provide a single source in task file" << endl;
return 255;
}
if( oTask.oScene.m_mReceivers.size() != 1 )
{
cerr << "[ERROR] Please provide a single receiver in task file, portals are not supported by simulator yet" << endl;
return 255;
}
if( oTask.oScene.m_mPortals.size() != 0 )
{
cerr << "[ERROR] Please do not provide portals in task file" << endl;
return 255;
}
cout << "Task acknowledged" << endl;
cout << " --- Task configuration: " << endl << oTask.oConfig.ToString() << endl;
cout << " --- Task scene: " << endl << oTask.oScene.ToString() << endl;
int iDifference = 0;
if( ( iDifference = oTask.oConfig.Validate() ) > 0 )
cout << "[WARNING] Detected odd configuration settings in Task1, bit vector was " << iDifference << endl;
cout << "Performing simulation" << endl;
pRavenSimulator->Compute( &oTask, &oResult );
cout << "Exporting result to '" << sResultPath << "'" << endl;
if( bNormalize )
normalize_0dB( oResult.vcspResult[0]->psfResult );
if( oTask.iSimulationType | CRavenSimulationTask::SIM_DS )
cout << "Direct sound was " << ( oResult.vcspResult[0]->bDirectSoundAudible ? "audible" : "inaudible" ) << endl;
if( oTask.iSimulationType != CRavenSimulationTask::SIM_DS )
writeAudiofile( sResultPath, oResult.vcspResult[ 0 ]->psfResult, oTask.oConfig.oSimulationSettings.dSampleRate );
if( oResult.vcspResult[0]->bEntitiesInSameRoom )
cout << "Entities (source and receiver) were in the same room." << endl;
else
cout << "Entities (source and receiver) were not in the same room." << endl;
IRavenSimulationInterface::CProfiler oStatus;
pRavenSimulator->GetProfilerStatus( oStatus );
cout << "Raven simulation profiler: " << oStatus << endl;
}
catch( ITAException& err )
{
cout << "[ERROR]: " << err << endl;
return 255;
}
return 0;
}
void normalize_0dB( ITASampleFrame* p )
{
float fGlobalPeak = 0.0f;
for( int i=0; i<p->length(); i++ )
{
ITASampleBuffer& p1 = (*p)[0];
ITASampleBuffer& p2 = (*p)[1];
float fSample1 = p1[i];
float fSample2 = p2[i];
fGlobalPeak = max( fGlobalPeak, fSample1 );
fGlobalPeak = max( fGlobalPeak, fSample2 );
}
if( fGlobalPeak != 0.0f )
p->mul_scalar( 1/fGlobalPeak );
}
cmake_minimum_required( VERSION 2.8 )
project( ravennest )
list( APPEND CMAKE_MODULE_PATH "$ENV{VISTA_CMAKE_COMMON}" )
include( VistaCommon )
vista_use_package( ITABase REQUIRED FIND_DEPENDENCIES )
vista_use_package( ITASimulationScheduler REQUIRED FIND_DEPENDENCIES )
if( NOT DEFINED ITA_RAVENNEST_INSTALL_WITH_DLLS )
set( ITA_RAVENNEST_INSTALL_WITH_DLLS ON CACHE BOOL "Install ravennest with depending DLLs (use this switch with care)" )
endif( NOT DEFINED ITA_RAVENNEST_INSTALL_WITH_DLLS )
if( NOT DEFINED ITA_RAVEN_DATA_PATH )
set( ITA_RAVEN_DATA_PATH "" CACHE PATH "RAVEN data base path (where to find models, HRTFs, etc. ...)" )
endif( NOT DEFINED ITA_RAVEN_DATA_PATH )
set( ProjectSources "getopt.c" "getopt.h" "ravennest.cpp" )
add_executable( ravennest ${ProjectSources} )
target_link_libraries( ravennest ${VISTA_USE_PACKAGE_LIBRARIES} )
add_definitions( "-DRAVENNEST_VERSION_MAJOR=1")
add_definitions( "-DRAVENNEST_VERSION_MINOR=0")
if( EXISTS "${ITA_RAVEN_DATA_PATH}" )
vista_set_target_msvc_arguments( ravennest "-rv -d ${ITA_RAVEN_DATA_PATH}" )
else( )
vista_set_target_msvc_arguments( ravennest "-h" )
endif( )
vista_configure_app( ravennest )
vista_install( ravennest )
vista_create_default_info_file( ravennest )
set_property( TARGET ravennest PROPERTY FOLDER "ITASimulationScheduler/Apps/Raven" )
if( ITA_RAVENNEST_INSTALL_WITH_DLLS OR ITA_RAVEN_INSTALL_WITH_DLLS )
vista_install_all_dlls( bin )
endif()
if( WIN32 )
install( FILES "run_ravennest_realtime.bat" DESTINATION "." )
else( )
install( FILES "run_ravennest_realtime.sh" DESTINATION "." )
endif( )
This diff is collapsed.
/* getopt.h */
/* Declarations for getopt.
Copyright (C) 1989-1994, 1996-1999, 2001 Free Software
Foundation, Inc. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute
it and/or modify it under the terms of the GNU Lesser
General Public License as published by the Free Software
Foundation; either version 2.1 of the License, or
(at your option) any later version.
The GNU C Library 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 Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General
Public License along with the GNU C Library; if not, write
to the Free Software Foundation, Inc., 59 Temple Place,
Suite 330, Boston, MA 02111-1307 USA. */
#ifndef _GETOPT_H
#ifndef __need_getopt
# define _GETOPT_H 1
#endif
/* If __GNU_LIBRARY__ is not already defined, either we are being used
standalone, or this is the first header included in the source file.
If we are being used with glibc, we need to include <features.h>, but
that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
not defined, include <ctype.h>, which will pull in <features.h> for us
if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
doesn't flood the namespace with stuff the way some other headers do.) */
#if !defined __GNU_LIBRARY__
# include <ctype.h>
#endif