Commit af1cd915 authored by Pascal Palenda's avatar Pascal Palenda
Browse files

Remove broken tests

parent 700ddfa2
......@@ -155,18 +155,8 @@ if( ITA_SIMULATION_SCHEDULER_TESTS )
if( ITA_SIMULATION_SCHEDULER_RAVEN_MODULE )
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( )
......
cmake_minimum_required( VERSION 2.8 )
project( LinuxRavenClusterNodeTest )
list( APPEND CMAKE_MODULE_PATH "$ENV{VISTA_CMAKE_COMMON}" )
include( VistaCommon )
vista_use_package( RavenNet REQUIRED FIND_DEPENDENCIES )
vista_use_package( RavenDistributedComputingInterface REQUIRED FIND_DEPENDENCIES )
vista_use_package( ITABase REQUIRED FIND_DEPENDENCIES )
vista_use_package( MPI REQUIRED )
add_executable( LinuxRavenClusterNodeTest "RavenNetSchedulerTest.cpp" )
target_link_libraries( LinuxRavenClusterNodeTest ${VISTA_USE_PACKAGE_LIBRARIES} )
vista_configure_app( LinuxRavenClusterNodeTest )
vista_create_default_info_file( LinuxRavenClusterNodeTest )
set_property( TARGET LinuxRavenClusterNodeTest PROPERTY FOLDER "ITASimulationScheduler/Tests/Raven" )
/*
* RAVEN Network Interface
*
* (c) Copyright Institut fr Technische Akustik (ITA)
* RWTH Aachen (http://www.akustik.rwth-aachen.de)
*
* ---------------------------------------------------------------------------------
*
* Datei: RavenNetTestServer.cpp
*
* Zweck: Test server, der Raven-Funktionalitt zur Verfgung stellt
*
* Autor(en): Jonas Stienen (stienen@akustik.rwth-aachen.de)
*
* ---------------------------------------------------------------------------------
*/
// $Id: RavenNetTestServer.cpp 2732 2012-06-26 13:38:17Z stienen $
#include <iostream>
#include <string>
#include <RavenNetServer.h>
#include <R_RavenSimulator.h>
using namespace std;
int main(int argc, void** argv) {
//string sServerName = "vrbox1";
string sServerName = "10.0.1.25";
//string sServerName = "192.168.1.104";
unsigned int uiPort = 12480;
IRavenNetServer::tPortList liFreePorts;
liFreePorts.push_back( IRavenNetServer::tPortRange( uiPort+1, 12499 ) );
cout << " * This is the RavenNet test server" << endl;
cout << " * Waiting for connections to " << sServerName << " on port " << uiPort << endl << endl;
CRavenSimulator* pSimulator = nullptr;
try {
// Create and set up Standalone Raven Simulator
CRavenSimulator* pSimulator = new CRavenSimulator();
} catch (ITAException& e) {
cout << e << endl;
delete pSimulator;
return 255;
}
// Create server and connect Raven instance
IRavenNetServer* pServer = IRavenNetServer::Create();
pServer->SetRavenSimulator( (IRavenSimulationInterface*) pSimulator );
try {
if (pServer->Initialize(sServerName, (int) uiPort, liFreePorts) != IRavenNetServer::RAVEN_NO_ERROR) {
cout << " * Could not initialize Raven server" << endl;
} else {
cout << " * Successfully initialized Raven server" << endl;
}
} catch (ITAException& err) {
cout << err << std::endl;
}
int iAnyKey;
cout << endl << " * Hit any key then enter to quit" << endl;
cin >> iAnyKey;
pServer->Finalize(); // Lscht auch den Simulator
return 0;
}
cmake_minimum_required( VERSION 2.8 )
project( OpenMPTest )
list( APPEND CMAKE_MODULE_PATH "$ENV{VISTA_CMAKE_COMMON}" )
include( VistaCommon )
vista_use_package( OpenMP REQUIRED FIND_DEPENDENCIES )
add_executable( OpenMPTest "openmp_test.cpp" )
target_link_libraries( OpenMPTest ${VISTA_USE_PACKAGE_LIBRARIES} )
vista_configure_app( OpenMPTest )
vista_create_default_info_file( OpenMPTest )
set_property( TARGET OpenMPTest PROPERTY FOLDER "ITASimulationScheduler/Tests/Raven" )
#include <iostream>
#ifdef _OPENMP
#include <omp.h>
#else
#define omp_get_num_threads() 0
#define omp_get_thread_num() 0
#endif
int main(int argc, const char **argv)
{
#ifdef _OPENMP
std::cout << "Preprocessor macro '_OPENMP' is defined" << std::endl;
#else
std::cout << "WARNING, preprocessor macro '_OPENMP' is NOT defined" << std::endl;
#endif
std::cout << "CPU count: " << omp_get_num_procs() << std::endl;
std::cout << "Max num threads: " << omp_get_max_threads() << std::endl;
#pragma omp parallel
{
int nthreads = omp_get_num_threads();
int thread_id = omp_get_thread_num();
std::cout << "Hello. I am thread " << thread_id
<< " out of a team of " << nthreads
<< std::endl;
}
std::cout << "Here I am, back to the main thread.\n";
return 0;
}
cmake_minimum_required( VERSION 2.8 )
project( RavenMPIClusterTest )
list( APPEND CMAKE_MODULE_PATH "$ENV{VISTA_CMAKE_COMMON}" )
include( VistaCommon )
vista_use_package( RavenNet REQUIRED FIND_DEPENDENCIES )
vista_use_package( RavenDistributedComputingInterface REQUIRED FIND_DEPENDENCIES )
vista_use_package( ITABase REQUIRED FIND_DEPENDENCIES )
vista_use_package( MPI REQUIRED )
add_executable( RavenMPIClusterTest "RavenNetSchedulerTest.cpp" )
target_link_libraries( RavenMPIClusterTest ${VISTA_USE_PACKAGE_LIBRARIES} )
vista_configure_app( RavenMPIClusterTest )
vista_create_default_info_file( RavenMPIClusterTest )
set_property( TARGET RavenMPIClusterTest PROPERTY FOLDER "ITASimulationScheduler/Tests/Raven" )
/*
* RAVEN Network Interface
*
* (c) Copyright Institut fr Technische Akustik (ITA)
* RWTH Aachen (http://www.akustik.rwth-aachen.de)
*
* ---------------------------------------------------------------------------------
*
* Datei: RavenNetTestServer.cpp
*
* Zweck: Test server, der Raven-Funktionalitt zur Verfgung stellt
*
* Autor(en): Jonas Stienen (stienen@akustik.rwth-aachen.de)
*
* ---------------------------------------------------------------------------------
*/
// $Id: RavenNetTestServer.cpp 2732 2012-06-26 13:38:17Z stienen $
#include <R_RavenSimulator.h>
#include <ITAFilesystemUtils.h>
#include <VistaInterProcComm/IPNet/VistaNetworkInfo.h>
#include <VistaInterProcComm/IPNet/VistaIPAddress.h>
#include <VistaBase/VistaTimeUtils.h>
#include <iostream>
#include <signal.h>
#include <string>
#include <stdlib.h>
#include <vector>
#include <mpi.h>
#ifdef WIN32
#define PATH_MAX 4069
#else
#include <limits.h>
#endif
class Config {
public:
int iState; // 0 => Los gehts, 1 => Fehler und beenden
char pszRavenConfigFile[PATH_MAX];
int iFieldOfDuty; //!< DS, IS, RT ...
};
class Message {
public:
enum {
COMMAND_START = 1,
COMMAND_QUIT
};
int iCommand;
static std::string GetCommandToString( const int iCommand ) {
if (iCommand == COMMAND_START)
return "Start";
if (iCommand == COMMAND_QUIT)
return "Quit";
return "Unkown";
}
};
// Define the function to be called when ctrl-c (SIGINT) signal is sent to process
void signal_handler(int signum) {
int iRank;
MPI_Comm_rank (MPI_COMM_WORLD, &iRank);
char filename[2024];
sprintf(filename, "rank_%i_signal_%d_received", iRank, signum);
FILE* pFileHandler = fopen(filename, "w");
char buf[2024];
int l = sprintf(buf, "Node %d: caught signal %d\n", iRank, signum);
fwrite(buf, sizeof(char), l, pFileHandler);
fclose(pFileHandler);
// Terminate program
MPI_Finalize();
exit(signum);
}
int main_master( int argc, char* argv[], int iRank, int iNumNodes ) {
//VistaTimeUtils::Sleep(3000);
Message oMessage;
oMessage.iCommand = Message::COMMAND_START;
if (iNumNodes < 4)
{
printf(" * ERROR: At least 4 nodes required, sending command quit to slaves\n" );
oMessage.iCommand = Message::COMMAND_QUIT;
}
std::string sRavenDataBasePath;
if (argc != 2)
{
printf(" * ERROR: RavenMPICluster takes exactly one argument, the absolute or relative path to Raven data.\n" );
oMessage.iCommand = Message::COMMAND_QUIT;
} else {
//sRavenDataBasePath = argv[1];
}
// Starten oder Stoppen senden
MPI_Bcast(&oMessage, sizeof(Message), MPI_BYTE, 0, MPI_COMM_WORLD);
// Falls etwas schief glelaufen ist, hier aussteigen
if (oMessage.iCommand == Message::COMMAND_QUIT) return EXIT_FAILURE;
// Determine field of duty for all nodes
for (int i=1; i<iNumNodes; i++) {
int iFieldOfDuty = CRavenSimulationTask::SIM_DS;
int iSwitch = (i-1) % 3;
if (iSwitch == 1) iFieldOfDuty = CRavenSimulationTask::SIM_IS;
if (iSwitch == 2) iFieldOfDuty = CRavenSimulationTask::SIM_RT;
// Konfiguration verteilen
Config oConfig;
oConfig.iState = Message::COMMAND_START;
oConfig.iFieldOfDuty = iFieldOfDuty;
strcpy(oConfig.pszRavenConfigFile, sRavenDataBasePath.c_str());
MPI_Send(&oConfig, sizeof(Config), MPI_BYTE, i, 0, MPI_COMM_WORLD);
}
// IP Adresse des Schedulers ausgeben
std::vector<VistaNetworkInfo> viNetworkinfos;
VistaNetworkInfo::EnumVistaNetworkInfo(viNetworkinfos);
printf(" * Node %i is set as scheduler (master)\n", iRank );
for (int i=0; i<(int) viNetworkinfos.size(); i++) {
std::string sAdress;
VistaIPAddress ip(viNetworkinfos[i].GetAddress());
ip.GetHostName(sAdress);
if (sAdress != "127.0.0.1")
printf(" + IP adress of adapter %i: %s\n", i, sAdress.c_str());
}
// Server startet Main Loop ...
// new RavenNetSchedulerFrontend();
// Diesen Thread hier stehen lassen
printf( " * Scheduler (master) suspended ... waiting for connections\n" );
while(true) VistaTimeUtils::Sleep(1e3);
return EXIT_SUCCESS;
}
int main_worker( int argc, char* argv[], int iRank, int iNumNodes )
{
//MPI_Barrier(MPI_COMM_WORLD);
Message oMessage;
MPI_Bcast( &oMessage, sizeof(Message), MPI_BYTE, 0, MPI_COMM_WORLD );
printf("\t* Worker %i got command '%s'\n", iRank, Message::GetCommandToString( oMessage.iCommand ).c_str());
if (oMessage.iCommand == Message::COMMAND_QUIT) return EXIT_FAILURE;
char filename[2024];
sprintf(filename, "rank_%i_started", iRank);
FILE* pFileHandler = fopen(filename, "w");
fclose(pFileHandler);
// Receive slave configuration from master
Config oSlaveConfig;
MPI_Recv(&oSlaveConfig, sizeof(Config), MPI_BYTE, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
printf( "\t* Field of duty for Raven cluster node %i: %i\n", iRank, oSlaveConfig.iFieldOfDuty);
//CRavenSimulator* pRaven = new CRavenSimulator;
// Diesen Thread hier stehen lassen
printf( "\t* Node %i suspended ... waiting for tasks\n", iRank );
while(true) VistaTimeUtils::Sleep(1e3);
//delete pRaven;
return EXIT_SUCCESS;
}
int main(int argc, char* argv[]) {
// Register signal and signal handler
signal(SIGINT, signal_handler);
int iRank, iSize, iResult;
MPI_Init (&argc, &argv);
MPI_Comm_rank (MPI_COMM_WORLD, &iRank);
MPI_Comm_size (MPI_COMM_WORLD, &iSize);
if (iRank==0)
iResult = main_master(argc, argv, iRank, iSize);
else
iResult = main_worker(argc, argv, iRank, iSize);
MPI_Finalize();
return iResult;
}
\ No newline at end of file
cmake_minimum_required( VERSION 2.8 )
project( RavenNetSchedulerTest )
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 )
add_executable( RavenNetSchedulerTest "RavenNetSchedulerTest.cpp" )
target_link_libraries( RavenNetSchedulerTest ${VISTA_USE_PACKAGE_LIBRARIES} )
vista_configure_app( RavenNetSchedulerTest )
vista_create_default_info_file( RavenNetSchedulerTest )
set_property( TARGET RavenNetSchedulerTest PROPERTY FOLDER "ITASimulationScheduler/Tests/Raven" )
#include <iostream>
#include <string>
#include <ITASimulationScheduler/Raven/RavenNetClient.h>
#include <ITASimulationScheduler/Raven/RavenNetServer.h>
#include <ITASimulationScheduler/LocalScheduler.h>
#include <ITASimulationScheduler/Utils.h>
#include <ITAStringUtils.h>
#include <ITAStopWatch.h>
using namespace std;
void normalize_0dB( ITASampleFrame* );
void test()
{
std::string sServerName = "localhost";
unsigned int uiPort = 12480;
ITASimulationScheduler::RAVEN::IRavenNetServer::tPortList liFreePorts;
liFreePorts.push_back( ITASimulationScheduler::RAVEN::IRavenNetServer::tPortRange( uiPort + 1, 12499 ) );
std::cout << "This is the RavenNet simulation server" << std::endl;
std::cout << "Waiting for connections to " << sServerName << " on port " << uiPort << std::endl << std::endl;
// Create and set up Standalone Raven Simulator
std::string sRavenDataPath = "../../../VAData";
ITASimulationScheduler::CLocalScheduler::CConfiguration oConf;
oConf.sRavenDataBasePath = sRavenDataPath;
ITASimulationScheduler::CLocalScheduler* pScheduler = new ITASimulationScheduler::CLocalScheduler( oConf );
// Create server and connect Raven instance
ITASimulationScheduler::RAVEN::IRavenNetServer* pServer = ITASimulationScheduler::RAVEN::IRavenNetServer::Create();
pServer->SetRavenSimulationScheduler( ( ITASimulationScheduler::ISimulationSchedulerInterface* ) pScheduler );
int err = pServer->Initialize( sServerName, ( int ) uiPort, liFreePorts, ITASimulationScheduler::RAVEN::IRavenNetServer::SCHEDULER );
if( err != ITASimulationScheduler::RAVEN::IRavenNetServer::RAVEN_NO_ERROR ) {
std::cout << "Could not initialize Raven simulation server" << std::endl;
}
else {
std::cout << "Successfully initialized Raven simulation server" << std::endl;
}
if( pServer->IsRavenSimulationScheduler() )
std::cout << "Raven simulation server provides scheduler (SchedulerInterface)" << std::endl;
if( pServer->IsRavenSimulator() )
std::cout << "Raven simulation server provides (serial) simulator (SimulationInterface)" << std::endl;
ITASimulationScheduler::RAVEN::IRavenNetClient* pClient = ITASimulationScheduler::RAVEN::IRavenNetClient::Create();
pClient->Initialize( sServerName );
ITASimulationScheduler::ISimulationSchedulerInterface* pRemoteScheduler = pClient->GetRavenSimulationScheduler();
pRemoteScheduler->Reset();
ITASimulationScheduler::CSimulationResultDumper oResultDumper( "./Output" );
pRemoteScheduler->AttachSimulationResultHandler( &oResultDumper );
ITASimulationScheduler::CSimulationTask oTask;
oTask.oConfig.oGeometry.sSceneFileName = "$(RavenDataBasePath)/Models/San Juan/SJ Double-Chapel Centered.ac";
oTask.oConfig.SetDefaults();
oTask.oScene.AddReceiver( 0 );
ITASimulationScheduler::RAVEN::CSourceState oState;
oTask.oScene.AddSource( 0 );
oState.vPos.init( 2, 1.7f, 2 );
oTask.oScene.SetSourceState( 0, oState );
unsigned int uiIDCounter = 0;
ITASimulationScheduler::CSimulationTask oTask1( oTask );
oTask1.uiID = uiIDCounter++;
oTask1.iSimulationType = ITASimulationScheduler::CSimulationTask::SIM_DS;
ITASimulationScheduler::CSimulationTask oTask2( oTask );
oTask2.uiID = uiIDCounter++;
oTask2.iSimulationType = ITASimulationScheduler::CSimulationTask::SIM_ER_IS;
ITASimulationScheduler::CSimulationTask oTask3( oTask );
oTask3.uiID = uiIDCounter++;
oTask3.iSimulationType = ITASimulationScheduler::CSimulationTask::SIM_DD_RT;
ITAStopWatch sw1;
for( int i = 0; i < 10000; i++ )
{
oTask1.uiID = uiIDCounter++;
sw1.start();
pRemoteScheduler->AddTask( &oTask1 );
sw1.stop();
}
std::cout << "Added 10k DS tasks in " << sw1.ToString() << std::endl;
ITASimulationScheduler::ISimulationSchedulerInterface::CProfiler oProfilerState;
if( pRemoteScheduler->GetProfilerStatus( oProfilerState ) )
{
cout << oProfilerState.oAll.dTaskComputeAvrg << endl;
cout << oProfilerState.oAll.dTaskTurnaroundDiscarded << endl;
cout << oProfilerState.oAll.dTaskTurnaroundFinished << endl;
cout << oProfilerState.oAll.uiTasksDiscarded << endl;
cout << oProfilerState.oAll.uiTasksFinished << endl;
}
ITAStopWatch sw2;
for( int i = 0; i < 1000; i++ )
{
oTask1.uiID = uiIDCounter++;
sw2.start();
pRemoteScheduler->AddTask( &oTask2 );
sw2.stop();
}
std::cout << "Added 1k IS tasks in " << sw2.ToString() << std::endl;
ITAStopWatch sw3;
for( int i = 0; i < 100; i++ )
{
oTask1.uiID = uiIDCounter++;
sw3.start();
pRemoteScheduler->AddTask( &oTask2 );
sw3.stop();
}
std::cout << "Added 100 RT tasks in " << sw3.ToString() << std::endl;
int iAnyKey;
std::cout << std::endl << "Hit any key then enter to quit" << std::endl << std::endl;
std::cin >> iAnyKey;
pRemoteScheduler->DetachSimulationResultHandler( &oResultDumper );
pServer->Finalize(); // Lscht auch den Simulator/Scheduler
}
int main( int argc, char** argv ) {
try
{
test();
}
catch( ITAException& e ) {
std::cout << e << std::endl;
}
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 = std::max( fGlobalPeak, fSample1 );
fGlobalPeak = std::max( fGlobalPeak, fSample2 );
}
if( fGlobalPeak != 0.0f )
p->mul_scalar( 1 / fGlobalPeak );
}
cmake_minimum_required( VERSION 2.8 )
project( RavenNetTestClient )
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 )
add_executable( RavenNetTestClient "RavenNetTestClient.cpp" )
target_link_libraries( RavenNetTestClient ${VISTA_USE_PACKAGE_LIBRARIES} )
vista_configure_app( RavenNetTestClient )
vista_create_default_info_file( RavenNetTestClient )
set_property( TARGET RavenNetTestClient PROPERTY FOLDER "ITASimulationScheduler/Tests/Raven" )
// RavenNet includes
#include <ITASimulationScheduler/Raven/RavenNetClient.h>
// Raven includes
#include <ITASimulationScheduler/Interfaces.h>
#include <ITASimulationScheduler/Raven/Simulator.h>
#include <ITASimulationScheduler/LocalScheduler.h>
#include <ITASimulationScheduler/Utils.h>