Ptb - error: synchronization failure!’

I am trying to run some scripts via Psychtoolbox-3 that we routinely use in the lab, but each time, I get the error: ‘PTB - ERROR: SYNCHRONIZATION FAILURE!’. In the past, we used to turn off the sync tests to get the scripts to run, because we couldn’t get them to disappear in Windows 10 with our setup. We just bought a new computer with the setup below, and are still getting the sync error.

The computer is running MatLab 64-Bit (Version 3.0.16) with a Navi 14 (Radeon RX 5500/5500M / Pro 5500M) graphics card on GNU/Linux X11 (Ubuntu 20.04), and the monitor is a Lacie electron blue 22” (though we have also tried with a Mitsubishi diamondpro 2070sb). The screen resolution is at 1024x768 and the refresh rate is set to 120hz. I posted the generated MatLab output below:

You need to give more details of the error (the full error text PTB returns), and run VBLSyncTest so we know the underlying code is correct… If you do see errors with VBLSyncTest then you should also increase the verbosity: Screen('Preference', 'Verbosity', 10); so the log is more complete.

Are you using the built-in drivers (MESA) or did you try to use the AMD proprietary ones?

If the log text is too long for the forum, put it in a Github gist or other text pasting site…

Thank you for your response Ian. There were errors with the VBLSyncTest, so I increased the verbosity as recommended, Screen(‘Preference’, ‘Verbosity’,10); Here is the full error text when the script is run with the increased verbosity. In terms of the driver, Linux said it was the “amdgpu”.

PTB-INFO: This is Psychtoolbox-3 for GNU/Linux X11, under Matlab 64-Bit (Version 3.0.16 - Build date: Apr 25 2020).

PTB-INFO: OS support status: Linux 5.4.0-48-lowlatency Supported.

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: Connected to Advanced Micro Devices, Inc. [AMD/ATI] Navi 14 [Radeon RX 5500/5500M / Pro 5500M] GPU with DCE-10.0 display engine [6 heads].

PTB-WARNING: Querying rasterbeam-position doesn’t work on your setup! (Returns a constant value 0)

PTB-WARNING: This can happen if Psychtoolbox gets the mapping of connected displays to graphics card

PTB-WARNING: outputs wrong. See ‘help DisplayOutputMappings’ for tips on how to resolve this problem.

PTB-WARNING: However, this probably doesn’t really matter on your setup for most purposes, as i can use OpenML

PTB-WARNING: timestamping instead, which is even more precise. Only few applications need beampos queries in this case.

PTB-WARNING: Couldn’t even collect one single valid flip interval sample! Sanity range checks failed!

PTB-WARNING: Could be a system bug, or a temporary timing problem. Retrying the procedure might help if

PTB-WARNING: the latter is the culprit.

PTB-WARNING: Couldn’t collect valid flip interval samples! Fatal VBL sync failure!

PTB-WARNING: Either synchronization of doublebuffer swapping to the vertical retrace signal of your display is broken,

PTB-WARNING: or the mechanism for detection of swap completion is broken. In any case, this is an operating system or gfx-driver bug!

WARNING: VBL Calibration run No. 1 failed. Retrying…

PTB-WARNING: Couldn’t even collect one single valid flip interval sample! Sanity range checks failed!

PTB-WARNING: Could be a system bug, or a temporary timing problem. Retrying the procedure might help if

PTB-WARNING: the latter is the culprit.

PTB-WARNING: Couldn’t collect valid flip interval samples! Fatal VBL sync failure!

PTB-WARNING: Either synchronization of doublebuffer swapping to the vertical retrace signal of your display is broken,

PTB-WARNING: or the mechanism for detection of swap completion is broken. In any case, this is an operating system or gfx-driver bug!

WARNING: VBL Calibration run No. 2 failed. Retrying…

WARNING: Will enable VBL busywait-workaround before trying final VBL Calibration run No. 3.

WARNING: This will hopefully work-around graphics driver bugs of the GPU sync-to-retrace mechanism. Cross your fingers!

PTB-WARNING: Couldn’t even collect one single valid flip interval sample! Sanity range checks failed!

PTB-WARNING: Could be a system bug, or a temporary timing problem. Retrying the procedure might help if

PTB-WARNING: the latter is the culprit.

PTB-WARNING: Couldn’t collect valid flip interval samples! Fatal VBL sync failure!

PTB-WARNING: Either synchronization of doublebuffer swapping to the vertical retrace signal of your display is broken,

PTB-WARNING: or the mechanism for detection of swap completion is broken. In any case, this is an operating system or gfx-driver bug!

PTB-INFO: OpenGL-Renderer is ATI Technologies Inc. :: Radeon RX 5500 XT :: 4.6.14736 Compatibility Profile Context 20.20

PTB-INFO: VBL startline = 768 , VBL Endline = -1

PTB-INFO: Will try to use OS-Builtin OpenML sync control support for accurate Flip timestamping.

PTB-INFO: Measured monitor refresh interval from VBLsync = 0.000000 ms [inf Hz]. (0 valid samples taken, stddev=1000000000.000000 ms.)

PTB-INFO: Reported monitor refresh interval from operating system = 11.765259 ms [84.996002 Hz].

PTB-INFO: Small deviations between reported values are normal and no reason to worry.

WARNING: Couldn’t compute a reliable estimate of monitor refresh interval! Trouble with VBL syncing?!?

WARNING: Mismatch between measured monitor refresh interval and interval reported by operating system.

This indicates massive problems with VBL sync.

----- ! PTB - ERROR: SYNCHRONIZATION FAILURE ! -----

One or more internal checks (see Warnings above) indicate that synchronization

of Psychtoolbox to the vertical retrace (VBL) is not working on your setup.

This will seriously impair proper stimulus presentation and stimulus presentation timing!

Please read ‘help SyncTrouble’ for information about how to solve or work-around the problem.

You can force Psychtoolbox to continue, despite the severe problems, by adding the command

Screen(‘Preference’, ‘SkipSyncTests’, 1); at the top of your script, if you really know what you are doing.

Error using Screen

See error message printed above.

Error in klein_baseline_demo (line 103)

w =Screen(‘OpenWindow’,ScreenNumber, gray);

You are using the proprietary AMD GPU driver (that is what I understand from PTB-INFO: OpenGL-Renderer is ATI Technologies Inc. :: Radeon RX 5500 XT :: 4.6.14736 Compatibility Profile Context 20.20, it should say X.org and MESA on that line), and proprietary driver is not recommended for PTB. Remove it and use the default open source driver; if you still have problems then it may require some work from Mario. As I understand it the newer GPUs from AMD have not received much testing. I usually recommend using a Polaris-era GPU like the WX5100 which works reliably with PTB…

What Ian says.

If it would require work from me it would also require your lab to buy priority support from us, as explained at the top of this forum and on our website.

One free tip though: UpdatePsychtoolbox. It contains some fixes specific to AMD Navi, which will silence some warnings that are false alerts.

It is true that Navi and its predecessor Vega are untested by myself. Atm. i’d lack both the funds and a suitable computer to plug a Navi card into it, because i think there aren’t any low-end, low power consumption Navi’s or Vega’s with less than 75 W power consumption and purely bus powered, and my current PC can’t handle more than that.

That said, i think i’ve by now seen two or three forum posts of successful Linux users of Navi, and there isn’t any reason or data atm. to suggest Navi’s being problematic. All i’ve seen so far was always user error in one way or another, e.g., installing the proprietary amdgpu-pro driver against our recommendations.

-mario

Thank you, Ian and Max. I was able to uninstall the amdgpu drivers and install and update x.org and mesa drivers. The first image is of those results in the command terminal. I then restarted the computer and program and got the following error (first script below). Followed by a second error when I ran the program (second script below). The link it provides to help fix the issue just suggested using, and updating, the Linux hard drives as we did. It also suggested potential memory issues or the inability of our graphics card to handle a hardware accelerated implementation, which should not be an issue as everything is installed and up to date on a new computer. Thank you for your help.

  1. error in the command window when rebooted program after installing x.org and messa and removing apu graphics designer
    com.jogamp.opengl.GLException: X11GLXDrawableFactory - Could not initialize shared resources for X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x0, owner false, ResourceToolkitLock[obj 0x69f00e2c, isOwner false, <19a8770f, 1f15b248>[count 0, qsz 0, owner ]]]
    at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:326)
    at jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:297)
    at java.lang.Thread.run(Thread.java:748)
    Caused by: com.jogamp.opengl.GLException: AWT-EventQueue-0-SharedResourceRunner: Unable to create temp OpenGL context(1)
    at jogamp.opengl.x11.glx.X11GLXContext.createImpl(X11GLXContext.java:368)
    at jogamp.opengl.GLContextImpl.makeCurrentWithinLock(GLContextImpl.java:759)
    at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:642)
    at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:580)
    at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:297)
    … 2 more
  1. Error when run experiment

MATLAB has experienced a low-level graphics error, and may not have drawn correctly.
Read about what you can do to prevent this issue at Resolving Low-Level Graphics Issues then restart MATLAB.
To share details of this issue with MathWorks technical support,
please include this file with your service request.
Couldn’t create JOGL canvas–using painters
Couldn’t create JOGL canvas–using painters
Couldn’t create JOGL canvas–using painters

ans =

 0     1
 0     1

PTB-INFO: This is Psychtoolbox-3 for GNU/Linux X11, under Matlab 64-Bit (Version 3.0.17 - Build date: Dec 17 2020).
PTB-INFO: OS support status: Linux 5.8.0-41-generic Supported.
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: For information about paid priority support, community membership and commercial services, please type
PTB-INFO: ‘PsychPaidSupportAndServices’.

PTB-ERROR:[glXCreateContext() failed] OpenGL context creation failed!

PTB-ERROR[Low-Level setup of window failed]:The specified gpu + display + gfx-driver combo may not support some requested feature.

Error using Screen
See error message printed above.

Error in klein_baseline_demo (line 104)
w =Screen(‘OpenWindow’,ScreenNumber, gray);

See Up to date hardware recommendations - #6 by Ian-Max-Andolina by Ian and my followup message for the likely fix. This is likely a Matlab bug, for which the workaround mentioned in that post is needed.

If that doesn’t work, i’d just reinstall the operating system, as maybe something got screwed up during your adventures in installing and uninstalling the proprietary drivers. Or you can buy priority support from us, so i can try to help you unmuddle this thing.

End of free advice for this thread from my side,
-mario

Hi Mario,
Thank you for your advice. We tried following what Ian-Max-Andolina posted. It says “matlab-support is already the newest version (0.0.21.1).” We are interested in buying your priority support!

Typing PsychPaidSupportAndServices will tell you how to get priority support.
-mario

Hi Mario, we purchased the priority support as suggested, here is the authentication key:

4DPPFVXE-202132172638:bc6475b155bd6866fc04f3e6f285138a86a319fb3e0100bd04330ac86c38ff6a

We were wondering what the next step would be to fix the error that pops up when we start the program, as well as the second error when we run the program. Both are shown in the thread above. Thank you for your assistance!

Ok. What Matlab version is this?

Run in a terminal:

sudo dpkg-reconfigure matlab-support

If it asks to the path of your Matlab installation, provide or select it from given options. If it asks if it should rename some Matlab libraries, answer with “YES”. This should fix some of Matlabs unfixed-since-years bugs that cause OpenGL to fail in Matlab.

Also run glxgears -info > glxoutput.txt from the terminal for at least 10 seconds, and install it via sudo apt install mesa-utils if it needs that first. This is a basic check if your AMD OpenGL drivers work correctly independent of Matlab and PTB. Post its output here, which you’ll conveniently find in the file glxoutput.txt.

Iff that works, then we know your graphics drivers are likely fine and it is a Matlab bug. It is time to start Matlab again and see if anything changed already. Best to test with our PerceptualVBLSyncTest script as a simple first test.

Also run UpdatePsychtoolbox again, so you are on the latest release from February this year. And then restart Matlab. Any change for the better?

Edit: Obviously once things work, you don’t need to go through other steps, but probably still good to post the output of PerceptualVBLSyncTest at least on success, so i can give it an extra look.

-mario

[Time used: 20 Minutes.]