Project

General

Profile

Bug #3310

Thread affinity on Mac OS

Added by Pascal Merz 8 months ago. Updated 7 months ago.

Status:
Blocked, need info
Priority:
Low
Assignee:
-
Category:
-
Target version:
-
Affected version - extra info:
Affected version:
Difficulty:
uncategorized
Close

Description

In gmx_set_thread_affinity (src/gromacs/mdrunutility/threadaffinity.cpp, line 425):

    /* If the tMPI thread affinity setting is not supported encourage the user
     * to report it as it's either a bug or an exotic platform which we might
     * want to support. */
    if (!affinityAccess->isThreadAffinitySupported())
    {
        /* we know Mac OS does not support setting thread affinity, so there's
           no point in warning the user in that case. In any other case
           the user might be able to do something about it. */
#if !defined(__APPLE__)
        GMX_LOG(mdlog.warning)
                .asParagraph()
                .appendText("NOTE: Cannot set thread affinities on the current platform.");
#endif /* __APPLE__ */
        return;
    }

The comment ("Mac OS does not support setting thread affinity") does not seem to be correct (because mine does - maybe on earlier version?). This just suppresses a log output, so it's not a harmful bug, but we should revisit that comment.

History

#1 Updated by Pascal Merz 8 months ago

  • Priority changed from Normal to Low

#2 Updated by Erik Lindahl 7 months ago

Grepping for "sched_setaffinity" in /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/pthread/sched.h does not return any hits on my MacBook Pro.

Apple does have its own (as usual, why follow any standard?) affinity API, but that is not able to pin threads to cores, it's just a way have threads with a similar tag try to run against the same L2 cache, but the MACH kernel still moves the threads around, AFAIK.

#3 Updated by Erik Lindahl 7 months ago

  • Status changed from New to Blocked, need info

Also available in: Atom PDF