Skip to content
Permalink
Browse files

Object distribution benchmark tool

  • Loading branch information
Stefan Eilemann authored and eile committed Dec 13, 2016
1 parent 5c40258 commit 523a5352265d85a69579188a3794e95471638cc0
@@ -49,8 +49,10 @@ class WindowSystem : public WindowSystemIF
{
public:
WindowSystem() {}

private:
std::string getName() const final { return "AGL"; }

eq::SystemWindow* createWindow(eq::Window* window,
const WindowSettings& settings) final
{
@@ -77,8 +79,11 @@ class WindowSystem : public WindowSystemIF
}

eq::SystemPipe* createPipe(eq::Pipe* pipe) final { return new Pipe(pipe); }

eq::MessagePump* createMessagePump() final { return new MessagePump; }

bool hasMainThreadEvents() const final { return true; }

bool setupFont(util::ObjectManager& gl, const void* key,
const std::string& name, const uint32_t size) const final
{
@@ -100,6 +100,13 @@ class PixelViewport
return false;
return true;
}

/**
* @return true if the given pixel viewport of a child entity is inside.
* @version 2.1
*/
bool fitsChild( const PixelViewport& pvp ) const
{ return pvp.getXEnd() <= w && pvp.getYEnd() <= h; }
//@}

/** @name Operations */
@@ -78,7 +78,7 @@ static inline uint32_t _uint32_neg(uint32_t a)
// Extend sign
static inline uint32_t _uint32_ext(uint32_t a)
{
return (((int32_t)a) >> 31);
return (a >> 31);
}

// And
@@ -1,5 +1,5 @@

/* Copyright (c) 2009-2013, Stefan Eilemann <eile@equalizergraphics.com>
/* Copyright (c) 2009-2016, Stefan Eilemann <eile@equalizergraphics.com>
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License version 2.1 as published
@@ -40,8 +40,10 @@ class WindowSystem : public WindowSystemIF
{
public:
WindowSystem() {}

private:
std::string getName() const final { return "WGL"; }

eq::SystemWindow* createWindow(eq::Window* window,
const WindowSettings& settings) final
{
@@ -51,7 +53,9 @@ class WindowSystem : public WindowSystemIF
}

eq::SystemPipe* createPipe(eq::Pipe* pipe) final { return new Pipe(pipe); }

eq::MessagePump* createMessagePump() final { return new MessagePump; }

bool setupFont(util::ObjectManager& gl, const void* key,
const std::string& name, const uint32_t size) const final
{
@@ -96,7 +96,8 @@ class RawVolumeModel
const VolumeScaling& getVolumeScaling() const { return _volScaling; }
void glewSetContext(const GLEWContext* context) { _glewContext = context; }
const GLEWContext* glewGetContext() const { return _glewContext; }
private:

protected:
bool _createVolumeTexture(GLuint& volume, DataInTextureDimensions& TD,
const eq::Range& range);

@@ -1,5 +1,5 @@

/* Copyright (c) 2007-2015, Stefan Eilemann <eile@equalizergraphics.com>
/* Copyright (c) 2007-2016, Stefan Eilemann <eile@equalizergraphics.com>
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License version 2.1 as published
@@ -0,0 +1,36 @@
# Copyright (c) 2016 Stefan.Eilemann@epfl.ch

include_directories(BEFORE ${PROJECT_SOURCE_DIR}/examples)
list(APPEND CPPCHECK_EXTRA_ARGS -I${PROJECT_SOURCE_DIR}/examples)

set(EQOBJECTBENCH_SOURCES
Client.cpp
Client.h
MemModel.h
MemModel.cpp
Model.h
PlyModel.h
PlyModel.cpp
Server.cpp
Server.h
hwsd.h
main.cpp
protocol.h
)

set(EQOBJECTBENCH_LINK_LIBRARIES PRIVATE Collage triply
${Boost_PROGRAM_OPTIONS_LIBRARY})

if(HWSD_FOUND)
add_definitions(-DEQOBJECTBENCH_USE_HWSD)
set(_hwsd_components hwsd_net_sys)
if(SERVUS_USE_DNSSD OR SERVUS_USE_AVAHI_CLIENT)
list(APPEND _hwsd_components hwsd_gpu_dns_sd hwsd_net_dns_sd)
endif()
list(APPEND EQOBJECTBENCH_LINK_LIBRARIES PRIVATE ${_hwsd_components} hwsd_net_dns_sd)
foreach(_component ${_hwsd_components})
add_definitions(-DEQOBJECTBENCH_USE_${_component})
endforeach()
endif()

common_application(eqObjectBench)
@@ -0,0 +1,97 @@

/* Copyright (c) 2016, Stefan.Eilemann@epfl.ch
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of Eyescale Software GmbH nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "Client.h"

#include "MemModel.h"
#include "PlyModel.h"
#include "Server.h"

namespace plydist
{

Client::Client( const int argc, char** argv )
{
// Setup network
co::init( argc, argv );
co::LocalNodePtr localNode = new co::LocalNode;
LBCHECK( localNode->initLocal( argc, argv ));

typedef co::CommandFunc< Client > CmdFunc;
const auto queue = localNode->getCommandThreadQueue();
localNode->registerCommand( CMD_CLIENT_MAP,
CmdFunc( this, &Client::_cmdMap ), queue );
localNode->registerCommand( CMD_CLIENT_SYNC,
CmdFunc( this, &Client::_cmdSync ), queue );

const co::Nodes& nodes = localNode->getNodes( false );
if( nodes.size() != 1 )
LBTHROW( std::runtime_error( "Client setup failure: " +
std::to_string( nodes.size( )) +
" nodes " ));

co::NodePtr master = nodes.front();
std::string modelName;
co::uint128_t modelID;
for( int i = 1; i < argc; ++i )
{
if(( std::string( "--model" ) == argv[i] ||
std::string( "-m" ) == argv[i] ) && i+1 < argc )
{
modelName = argv[i+1];
}
if( std::string( "--model-id" ) == argv[i] && i+1 < argc )
modelID = std::string( argv[i+1] );
}

master->send( CMD_NODE_DONE );

// map model
_map.waitEQ( true );
std::unique_ptr< Model > model;
if( modelName.empty() ||
( modelName.length() > 3 &&
modelName.compare( modelName.size() - 4, 4, ".ply" ) == 0 ))
{
model.reset( new PlyModel( master, localNode, modelID ));
}
else
model.reset( new MemModel( master, localNode, modelID ));
master->send( CMD_NODE_DONE );

// sync model
const uint32_t nCommits = _sync.waitNE( 0 );
for( size_t i = 0; i < nCommits; ++i )
model->sync( eq::uint128_t( co::VERSION_NEXT ));
master->send( CMD_NODE_DONE );

model.reset();
localNode->exitLocal();
co::exit();
}
}
@@ -0,0 +1,51 @@

/* Copyright (c) 2016, Stefan.Eilemann@epfl.ch
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of Eyescale Software GmbH nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

#pragma once
#include "protocol.h"

#include <triply/vertexBufferDist.h>

namespace plydist
{
/** Class simulating Equalizer render client object access behaviour */
class Client : public co::Dispatcher
{
public:
Client( const int argc, char** argv );

private:
bool _cmdMap( co::ICommand& ) { _map = true; return true; }
bool _cmdSync( co::ICommand& cmd )
{ _sync = cmd.read< uint32_t >(); return true; }

lunchbox::Monitorb _map; //!< start signal for mapping
lunchbox::Monitor< uint32_t > _sync; //!< start signal and # of sync() ops
};

}
@@ -0,0 +1,61 @@

/* Copyright (c) 2016, Stefan.Eilemann@epfl.ch
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of Eyescale Software GmbH nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "MemModel.h"

namespace plydist
{
namespace
{
const size_t pageSize = LB_4KB;
}

MemModel::MemModel( const co::Object::ChangeType type,
const co::CompressorInfo& compressor,
const std::string& name, co::LocalNodePtr localNode )
: Model( type, compressor )
, _map( name )
{
// touch mmap'ed data once to not skew first operation with page faults
for( size_t i = 0; i < _map.getSize(); i += pageSize )
_map.get< uint8_t >( i );
localNode->registerObject( this );
}

MemModel::MemModel( co::NodePtr master, co::LocalNodePtr localNode,
const co::uint128_t& id )
{
localNode->mapObject( this, id, master );
}

MemModel::~MemModel()
{
if( isAttached( ))
co::Object::getLocalNode()->releaseObject( this );
}
}

0 comments on commit 523a535

Please sign in to comment.
You can’t perform that action at this time.