[FieldTrip] Pthread install

Robert Oostenveld r.oostenveld at donders.ru.nl
Tue Feb 7 11:26:24 CET 2012

Dear Chad

All peer functions rely on a single mex file. That mex file implements a TCP server and client in a seperate thread, which allows MATLAB to receive data while at the same time busy with computations. The TCP networking details are slightly different between operating systems. The computers we work with most are unix-bases (linux, os x), therefore those are the ones that we primarily target with out code. Stefan, a former colleague at the Donders has compiled it once on windows32 and 64, but that mex file has not been kept up to date since then.

The peer TCP server and client are derived from the FieldTrip buffer (see http://fieldtrip.fcdonders.nl/development/realtime) which is the result of a project to allow MATLAB to do efficient and easy computations on real-time streamed EEG and MEG data. The fieldtrip realtime buffer works well on all operating systems, so as such there is no reason to assume that peer would also not work.

The TCP server and the other peer threads (i.e. announce, discover, expire) are all implemented with posix threads, which is the default on unix-like operating systems (linux, os x). On MS Windows there is another threading system, but there is a port of pthreads for windows (see http://sourceware.org/pthreads-win32/). 

At the time we implemented this stuff, there was only a version available for 32-bit windows, whereas nowadays most Windows computers are 64 bit. Stefan made a 64-bit version of the "ptherads-win32" library himself, that is the one we also use for the fieldtrip buffer. That library and header files can be found in fieldtrip/realtime/buffer/pthreads-win64. It might also be that there is an official release of the pthreads library for win64, if there is, I suggest you use that instead of the fieldtrip version. 

An alternative might be to use mingw as a compiler: if I recall correctly it also includes pthreads. But then, I don't know how easy or hard it is to use the mingw compiler in combination with MATLAB.

hope this helps,

PS yet another aspect is the peerslave.exe command line application that allows to start a slave prior to starting MATLAB. Although also for that one Stefan managed to get a version compiled, but I know that that version is buggy. Even the linux version is not 100% stable. At the time Stefan worked with us, it was decided not to spend time on resolving the windows bugs in command-line version. Therefore I suggest that you first focus on getting the mex file to work, and only then start thinking on whether you need the peerslave.exe command-line version.

On 3 Feb 2012, at 16:06, Chad Bircher wrote:

> I am trying to install the peer directories, but cannot run peercompile('VC') on my Windows7 64bit machine using Microsoft Visual C++ express 2012.  I am getting an error that it cannot find pthread.h 
> I am not a systems developer, and do not know how to install this correctly.  Every attempt I have made still does not allow peercompile to run.
> How do I install pthread on this sort of a system?
> Thank you
> Chad
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120207/14a84f7a/attachment-0002.html>

More information about the fieldtrip mailing list