matlab initialization

Concerning processing components: filters, file load/save, visualizations, communication ...
Post Reply
ddvlamin
Posts: 160
Joined: Thu Aug 13, 2009 8:39 am
Location: Ghent University
Contact:

matlab initialization

Post by ddvlamin »

Hi,

We want to use the matlab filter box for an experiment, but we need to do some time consuming initialization before we can start processing.

The initialize function that one specifies in the matlab filter box settings actually seems to refer to a function that processes the header, so it complained about not reaching realtime. So I thought to extend the box with an additional setting that specifies the name of a function that does some offline initialization of the matlab workspace. This matlab initialize function is then called in the initialize function of the OpenViBE box and thus not in its process function. However, this still does not work.

Why is it that a very long initialization of an OpenViBE box slows down the whole scenario after the initialization has been correctly executed, while the other two matlab functions for processing the buffer and header have a low execution time? Is there something that I can do to resolve this issue?

Best regards,
Dieter Devlaminck

lbonnet
Site Admin
Posts: 417
Joined: Wed Oct 07, 2009 12:11 pm

Re: matlab initialization

Post by lbonnet »

Hi Dieter,

I checked with a box with high initialization time (matrix display with sinus oscillator 32 channel X 32 samples).
Indeed the scenario try catch up the processing time afterwards (warning messages with "cannot reach real time").

It means that while the box is initializing, the openvibe player clock is ticking.
If you don't need the first seconds of signal it may be ok... I mean if you let the designer reach the real-time you're good for the rest of the experiment.
It's of course a problem if you have to display some instruction or stimulation on screen in the mean time for example.

Hum.. I'm not sure what to think about this, basically because I don't know how it is implemented in details in the kernel part.


Laurent
Follow us on twitter >> openvibebci

Checkout my (old) blog for some OpenViBE tips & tricks : here !

ddvlamin
Posts: 160
Joined: Thu Aug 13, 2009 8:39 am
Location: Ghent University
Contact:

Re: matlab initialization

Post by ddvlamin »

So a future OpenViBE feature would be to start the clock only when all boxes are initialized?

Anyway I could live with the fact that I have to wait until the scenario catches up, but herein lies my problem, it does not catch up. Instead time starts to go very very slow, as in a couple of milliseconds per second, while it has almost nothing to do (matlab processing function is basically a dummy). When the initialization is also set to some dummy stuff that does not take long, the scenario runs fine. So apparently that's a issue on my computer then and not a general problem?

Thanks,
Dieter Devlaminck

jlegeny
Posts: 239
Joined: Tue Nov 02, 2010 8:51 am
Location: Mensia Technologies Paris FR
Contact:

Re: matlab initialization

Post by jlegeny »

Is it possible to profile the matlab function to see how long does it take for it to process the dummy function? It would be interesting to see whether the problem lies on OpenViBE's or matlab's side.

Are there other boxes besides the matlab one in the scenario?

ddvlamin
Posts: 160
Joined: Thu Aug 13, 2009 8:39 am
Location: Ghent University
Contact:

Re: matlab initialization

Post by ddvlamin »

Here is the output of the processing
[ INF ] At time 0.000 sec <Box algorithm::Matlab filter> >> OpenViBE called bci_Initialize2 function
PTB-INFO: Display ':0.0' : X-Screen 0 : Output 0 [default]: Unknown output priority : Connected : CRTC 0 [XID 351]
PTB-INFO: Display ':0.0' : X-Screen 0 : Assigning primary output as 0 with RandR-CRTC 0 and GPU-CRTC 0.


PTB-INFO: This is Psychtoolbox-3 for GNU/Linux X11, under Matlab (Version 3.0.9 - Build date: Mar 31 2012).
PTB-INFO: Type 'PsychtoolboxVersion' for more detailed version information.
PTB-INFO: Most parts of the Psychtoolbox distribution are licensed to you under terms of the MIT License, with
PTB-INFO: some restrictions. See file 'License.txt' in the Psychtoolbox root folder for the exact licensing conditions.

PTB-INFO: nVidia Corporation - G98M [Quadro NVS 160M] GPU found. Trying to establish low-level access...
PTB-INFO: Failed to map GPU low-level control registers for screenId 0 [Permission denied].
PTB-INFO: Beamposition timestamping and other special functions disabled.
PTB-INFO: You must run Matlab/Octave with root privileges for this to work.
PTB-INFO: However, if you are using the free graphics drivers, there isn't any need for this.
PTB-INFO: Failed to enable realtime-scheduling [Operation not permitted]!
PTB-INFO: You need to run Matlab or Octave with root-privileges, or run the script PsychLinuxConfiguration once for this to work.


PTB-INFO: OpenGL-Renderer is NVIDIA Corporation :: Quadro NVS 160M/PCI/SSE2 :: 3.3.0 NVIDIA 280.13
PTB-INFO: VBL startline = 1200 , VBL Endline = -1
PTB-INFO: Beamposition queries unsupported or defective on this system. Using basic timestamping as fallback: Timestamps returned by Screen('Flip') will be less robust and accurate.
PTB-INFO: Measured monitor refresh interval from VBLsync = 16.679759 ms [59.952905 Hz]. (50 valid samples taken, stddev=0.033123 ms.)
PTB-INFO: Reported monitor refresh interval from operating system = 16.680845 ms [59.949001 Hz].
PTB-INFO: Small deviations between reported values are normal and no reason to worry.
PTB-INFO: Support for fast OffscreenWindows enabled.
Creating windows...
[ INF ] At time 0.008 sec <Box algorithm::Matlab filter> >> OpenViBE called bci_ProcessHeader function
Elapsed time is 0.000068 seconds.

[ INF ] At time 0.070 sec <Box algorithm::Matlab filter> >> bci_process2 called
Elapsed time is 0.000557 seconds.

[WARNING] <Player::can not reach realtime> 1 second(s) late...
[ INF ] At time 0.133 sec <Box algorithm::Matlab filter> >> bci_process2 called
Elapsed time is 0.000144 seconds.

[WARNING] <Player::can not reach realtime> 4 second(s) late...
[ INF ] At time 0.195 sec <Box algorithm::Matlab filter> >> bci_process2 called
Elapsed time is 0.000095 seconds.

[WARNING] <Player::can not reach realtime> 7 second(s) late...
[ INF ] At time 0.258 sec <Box algorithm::Matlab filter> >> bci_process2 called
Elapsed time is 0.000122 seconds.

[WARNING] <Player::can not reach realtime> 10 second(s) late...
[ INF ] At time 0.320 sec <Box algorithm::Matlab filter> >> bci_process2 called
Elapsed time is 0.000123 seconds.

[WARNING] <Player::can not reach realtime> 13 second(s) late...
[ INF ] At time 0.383 sec <Box algorithm::Matlab filter> >> bci_process2 called
Elapsed time is 0.000124 seconds.

[WARNING] <Player::can not reach realtime> 15 second(s) late...
[ INF ] At time 0.445 sec <Box algorithm::Matlab filter> >> bci_process2 called
Elapsed time is 0.000154 seconds.

[WARNING] <Player::can not reach realtime> 18 second(s) late...
[ INF ] At time 0.508 sec <Box algorithm::Matlab filter> >> bci_process2 called
Elapsed time is 0.000127 seconds.

[WARNING] <Player::can not reach realtime> 21 second(s) late...
[ INF ] At time 0.570 sec <Box algorithm::Matlab filter> >> bci_process2 called
Elapsed time is 0.000122 seconds.

[WARNING] <Player::can not reach realtime> 24 second(s) late...
[ INF ] At time 0.633 sec <Box algorithm::Matlab filter> >> bci_process2 called
Elapsed time is 0.000122 seconds.

[WARNING] <Player::can not reach realtime> 26 second(s) late...
[ INF ] At time 0.695 sec <Box algorithm::Matlab filter> >> bci_process2 called
Elapsed time is 0.000123 seconds.

[WARNING] <Player::can not reach realtime> 29 second(s) late...
[ INF ] At time 0.758 sec <Box algorithm::Matlab filter> >> bci_process2 called
Elapsed time is 0.000124 seconds.

[WARNING] <Player::can not reach realtime> 32 second(s) late...
[ INF ] At time 0.820 sec <Box algorithm::Matlab filter> >> bci_process2 called
Elapsed time is 0.000124 seconds.

[WARNING] <Player::can not reach realtime> 34 second(s) late...
[ INF ] At time 0.883 sec <Box algorithm::Matlab filter> >> bci_process2 called
Elapsed time is 0.000122 seconds.

[WARNING] <Player::can not reach realtime> 37 second(s) late...
[ INF ] At time 0.945 sec <Box algorithm::Matlab filter> >> bci_process2 called
Elapsed time is 0.000216 seconds.

[WARNING] <Player::can not reach realtime> 40 second(s) late...
As you can see the processing in the matlab does not take long, but the delay keeps adding.

There is only two keyboard stimulators and a lua stimulator, plus sinus oscillator and the matlab filter box in the scenario, so very light-weighted.

However, I noticed something weird that after the initialization it outputs the words "Creating windows..." but in fact there should be some extra lines printed (just another print line) just after that disp command, but they are not shown. What could be the reason of this, maybe this can be a hint to the cause of the problem. Either the matlab initialization function is not entirely completed or it is completed and OpenViBE or something else did not display the entire output?

Dieter

Post Reply