Go Back   nV News Forums > Linux Support Forums > General Linux

Newegg Daily Deals

Reply
 
Thread Tools
Old 01-31-08, 12:36 AM   #1
tanmay.anjaria
Registered User
 
Join Date: Oct 2007
Posts: 17
Default linux library needed for pthread_setaffinity_np

Hello,

I'm using a quad processor system. I want a program running on my PC having four threads and each of them running on different processors.

I'm using function "pthread_setaffinity_np" for that. while compiling, it gives an error saying "undefined reference to : pthread_setaffinity_np"

Can anyone tell me which library should be included for "pthread_setaffinity_np" ?

Thanks in advance...

Tanmay
tanmay.anjaria is offline   Reply With Quote
Old 01-31-08, 02:10 AM   #2
mlauss
Registered User
 
Join Date: Aug 2007
Posts: 43
Default Re: linux library needed for pthread_setaffinity_np

Did you add "-lpthread" (a.k.a tell gcc to use the libpthread library) to the compiler commandline?
mlauss is offline   Reply With Quote
Old 01-31-08, 03:02 AM   #3
tanmay.anjaria
Registered User
 
Join Date: Oct 2007
Posts: 17
Default Re: linux library needed for pthread_setaffinity_np

yes, I'm using -lpthread currently...

command line goes like this...

gcc -lm -lpthread test.c
tanmay.anjaria is offline   Reply With Quote
Old 01-31-08, 05:35 AM   #4
mlauss
Registered User
 
Join Date: Aug 2007
Posts: 43
Default Re: linux library needed for pthread_setaffinity_np

Your libc appears to be missing NPTL bits

This is from glibc-2.7 (which is NPTL only):
# nm /lib/libpthread-2.7.so | grep setaffinity
0000e0c0 t __pthread_attr_setaffinity_new
0000e1c0 t __pthread_attr_setaffinity_old
0000ded0 t __pthread_setaffinity_new
0000df80 t __pthread_setaffinity_old
0000e0c0 T pthread_attr_setaffinity_np@@GLIBC_2.3.4
0000e1c0 T pthread_attr_setaffinity_np@GLIBC_2.3.3
0000ded0 T pthread_setaffinity_np@@GLIBC_2.3.4
0000df80 T pthread_setaffinity_np@GLIBC_2.3.3

Also, maybe it works with
#include<nptl/pthread.h>
since I'm told pthread_setaffinity_np() is a wrapper around
the sched_setaffinity() call (you know the "static inline" kind of wrapper ;-) )
mlauss is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
295.59 (long-lived branch release) for Linux x86/x86_64 released artem NVIDIA Linux 0 06-11-12 11:25 AM
nVidia Linux drivers with Linux on Mac, help? Thetargos NVIDIA Linux 0 05-13-12 12:52 PM
295.40 (long-lived branch release) for Linux x86/x86_64 released danix NVIDIA Linux 0 04-11-12 08:25 AM
Mandrake Linux 9.0 (Dolphin) now available | comments? volt General Linux 10 10-19-02 10:13 PM
Linux VS. Windows XP! XP wins! dostler NVIDIA Linux 20 09-15-02 03:47 PM

All times are GMT -5. The time now is 11:56 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.