Skip to content

Commit 13c9756

Browse files
maxim-belkinfacebook-github-bot
authored andcommitted
c10/util/thread_name.cpp: pthread_setname_np requires Glibc 2.12 (pytorch#55063)
Summary: `pthread_setname_np` requires Glibc 2.12. The patch reproduces what numactl does: https://github.com/numactl/numactl/blob/93867c59b0bb29470873a427dc7f06ebaf305221/syscall.c#L132-L136 Related to issue pytorch#23482 and the `pthread_setname_np.patch` patch that adamjstewart shared. Pull Request resolved: pytorch#55063 Reviewed By: soulitzer Differential Revision: D28577146 Pulled By: malfet fbshipit-source-id: 85867b6f04795b1ae7bd46dbbc501cfd0ec9f163
1 parent 76ce925 commit 13c9756

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

c10/util/thread_name.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
#include <algorithm>
44

5-
#if defined(__GLIBC__) && !defined(__APPLE__) && !defined(__ANDROID__)
5+
#ifndef __GLIBC_PREREQ
6+
#define __GLIBC_PREREQ(x, y) 0
7+
#endif
8+
9+
#if defined(__GLIBC__) && __GLIBC_PREREQ(2, 12) && !defined(__APPLE__) && \
10+
!defined(__ANDROID__)
611
#define C10_HAS_PTHREAD_SETNAME_NP
712
#endif
813

0 commit comments

Comments
 (0)