Giter Site home page Giter Site logo

Comments (8)

radfordneal avatar radfordneal commented on June 24, 2024

Thanks for the report. I've just started playing myself with pqR on a Mac, but haven't tried the GUI yet. As others have reported, helper threads don't work at all with the version of gcc 4.2 distributed with Xcode (at least in the old Xcode 3.2.6 on Snow Leopard that I'm using at the moment), since it doesn't support the "threadprivate" feature of OpenMP. I found that helper threads do work with gcc 4.7.3 (but don't try it with -O3). Could you say what compiler you are using? Does pqR with helper threads work when you compile it without the R GUI?

The error above seems to result from the threadprivate pointer variable this_task_info being null, when it should point to a suitable structure. So this could have something to do with support (or lack of it) for the threadprivate feature. Is it possible that you compiled the shared library for pqR with a compiler supporting "threadprivate", but this library was then called from a GUI that was compiled with a compiler that doesn't support this feature, and hence didn't initialize properly for use of threadprivate variables? (This is speculation. I haven't investigated the GUI and OpenMP on Macs enough yet to know whether this scenario actually makes sense...)

from pqr.

radfordneal avatar radfordneal commented on June 24, 2024

Or, continuing my speculation, could it be that the GUI was compiled with a suitable compiler, but without the -fopenmp option to gcc?

from pqr.

randy3k avatar randy3k commented on June 24, 2024

Is it possible that you compiled the shared library for pqR with a compiler supporting "threadprivate", but this library was then called from a GUI that was compiled with a compiler that doesn't support this feature, and hence didn't initialize properly for use of threadprivate variables?

Yes, you are right. I am now trying to use GNU gcc to compile the GUI, but it seems to be not obvious..

from pqr.

randy3k avatar randy3k commented on June 24, 2024

When I complied the guy with GNU gcc... I got the followings..

    /usr/local/Cellar/gcc47/4.7.3/bin/gcc-4.7 -x objective-c-header -fmessage-length=0 -pipe -std=gnu99 -Wno-trigraphs -O0 -DUSE_POOLS -gdwarf-2 -fvisibility=hidden -I/Users/Randy/Desktop/pqR/Mac-GUI-1.53 -I/Users/Randy/Desktop/pqR/Mac-GUI-1.53/build/Debug/include -I/opt/Frameworks/R.framework/Headers -I/opt/Frameworks/R.framework/PrivateHeaders -I/Users/Randy/Desktop/pqR/Mac-GUI-1.53/build/R.build/Debug/R.build/DerivedSources/x86_64 -I/Users/Randy/Desktop/pqR/Mac-GUI-1.53/build/R.build/Debug/R.build/DerivedSources -Wall -F/Users/Randy/Desktop/pqR/Mac-GUI-1.53/build/Debug -F/opt/Frameworks -DPLAIN_STDERR -DDEBUG_RGUI -DUSE_POOLS -c /Users/Randy/Desktop/pqR/Mac-GUI-1.53/R_Prefix.pch -o /var/folders/w9/7w10svxj5093z4831n7m27w00000gp/C/com.apple.Xcode.502/SharedPrecompiledHeaders/R_Prefix-hakfwqlftgjqhleiynzlpicfjuuw/R_Prefix.pch.gch
In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:123:0,
                 from /System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12,
                 from /Users/Randy/Desktop/pqR/Mac-GUI-1.53/R_Prefix.pch:6:
/System/Library/Frameworks/Foundation.framework/Headers/NSTask.h:69:24: error: expected identifier or '(' before '^' token
/System/Library/Frameworks/Foundation.framework/Headers/NSTask.h:72:1: error: expected identifier before 'end'

It seems that the GNU gcc won't compile some system header files.
However, the working complier (by Apple) doesn't support openmp....
I don't have any clue at this moment.

from pqr.

radfordneal avatar radfordneal commented on June 24, 2024

I'm planning to try this out myself soon. I'll see whether I can figure out a solution. Thanks for trying it, and getting as far as identifying the problem here.

from pqr.

radfordneal avatar radfordneal commented on June 24, 2024

From a quick look at the R GUI code, it seems that it doesn't call the usual R mainloop procedure (in src/main.c), which is where helpers_startup is called to set up the whole helpers scheme. So I think the R GUI needs to be modified to call helpers_startup itself at some appropriate point. I can't guess whether the R GUI also needs to be compiled with a compiler that support OpenMP threadprivate variables, but I think just using such a compiler would not be sufficient.

from pqr.

randy3k avatar randy3k commented on June 24, 2024

I think that setup_Rmainloop() is called in REngine/Rinit.m and it is the source of error.

from pqr.

radfordneal avatar radfordneal commented on June 24, 2024

Calling setup_Rmainloop isn't sufficient. The actual Rf_mainloop procedure needs to be called. It's not possible for the full setup to be done in a separate "setup" function because OpenMP creates threads as a result of a "parallel" construct, with the threads being destroyed when that construct is left. So the whole main part of the R interpreter needs to be called from within that parallel construct, which exists inside the mainloop procedure.

from pqr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.