Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple videocards? upd: with tests #9

Open
eps696 opened this issue Mar 18, 2020 · 1 comment
Open

multiple videocards? upd: with tests #9

eps696 opened this issue Mar 18, 2020 · 1 comment

Comments

@eps696
Copy link

eps696 commented Mar 18, 2020

hi, i've seen some activity over here recent months (glad to face it after ~3 yrs of silence).
does anybody have an idea how to use this lib with multi-card setup?
there's SetAdapter feature in SpoutSDK, would be ultracool to have it operating in python lib too (or to know how to call it, if it's there already)

@eps696
Copy link
Author

eps696 commented Mar 22, 2020

i've managed to add the function calls for adapter control, compiled as explained here https://rusin.work/vjing/tools/spout-for-python, but still didn't make it work end-to-end with multiGPU setup. the lib and Spout don't issue errors anymore, but the final receiver doesn't show anything either.
here is what i did:

Spout.cpp:

#define BOOST_PYTHON_STATIC_LIB
#include "Spout.h"
#include <boost/python.hpp>

BOOST_PYTHON_MODULE(SpoutSDK)
{
	using namespace boost::python;

	class_<SpoutSender>("SpoutSender")
		.def("CreateSender", &SpoutSender::CreateSender)
		.def("GetNumAdapters", &SpoutSender::GetNumAdapters)
		.def("SetAdapter", &SpoutSender::SetAdapter)
		.def("GetAdapter", &SpoutSender::GetAdapter)
		.def("SayHello", &SpoutSender::SayHello)
		.def("SendTexture", &SpoutSender::SendTexture)
		.def("ReleaseSender", &SpoutSender::ReleaseSender)
		;
	class_<SpoutReceiver>("SpoutReceiver")
		.def("pyCreateReceiver", &SpoutReceiver::pyCreateReceiver)
		.def("GetNumAdapters", &SpoutReceiver::GetNumAdapters)
		.def("SetAdapter", &SpoutReceiver::SetAdapter)
		.def("GetAdapter", &SpoutReceiver::GetAdapter)
		.def("pyReceiveTexture", &SpoutReceiver::pyReceiveTexture)
		.def("ReleaseReceiver", &SpoutReceiver::ReleaseReceiver)
		.def("SelectSenderPanel", &SpoutReceiver::SelectSenderPanel)
		.def("GetWidth", &SpoutReceiver::GetWidth)
		.def("GetHeight", &SpoutReceiver::GetHeight)
		;
}

python calls (same for SpoutReceiver):

adapter_num = 1
spout_name = 'source'
width = height = 512
spoutSender = SpoutSDK.SpoutSender()
spoutSender.SetAdapter(adapter_num)
print(' .. Sender on GPU', spoutSender.GetAdapter(), 'of', spoutSender.GetNumAdapters())
spoutSender.CreateSender(spout_name, width, height, 0) 
print(' .. Sender created')

further advices are welcome

here are the compiled libs for all python 3.x versions
multigpu.zip

@eps696 eps696 changed the title multiple videocards? multiple videocards? upd: with tests Mar 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant