Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: Re: [OMPI devel] Replacing poll()
From: Jeffrey Squyres (jsquyres_at_[hidden])
Date: 2012-03-02 09:33:40


Note that the OMPI 1.4.x series is about to be retired. If you're doing new stuff, I'd advise you to be working with the Open MPI SVN trunk. In the trunk, we've changed how we build libevent, so if you're adding to it, you probably want to be working there for max forward-compatibility.

That being said:

> I know trying to replace poll() seems like I'm doing something very wrong, but I want to poll on events without a valid linux file descriptor (and existing events, specifically sockets, at the same time), and I see no other way. Obviously, my poll2 calls the linux poll in most cases.

What exactly are you trying to do? OMPI has some internal hooks for non-fd-or-event-based progress. Indeed, libevent is typically called with fairly low frequency (e.g., if you're running with OpenFabrics or some other high-speed/not-fd-based networking interconnect).

On Mar 2, 2012, at 7:33 AM, Alex Margolin wrote:

> I added my poll2.c to config/ompi_setup_libevent.m4 next to poll.c and was able to build successfully, but even if poll2() just (prints and) calls poll() - I get the following error (btl is specified to avoid loading my module at this time):
>
> alex_at_singularity:~/huji/benchmarks/simple$ ~/huji/ompi4/bin/mpirun -mca btl self,tcp -n 2 ./pong
> Inside poll2!
> [singularity:32552] *** Process received signal ***
> [singularity:32552] Signal: Segmentation fault (11)
> [singularity:32552] Signal code: Address not mapped (1)
> [singularity:32552] Failing at address: (nil)
> [singularity:32552] [ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0x10060) [0x7f7d6ac26060]
> [singularity:32552] *** End of error message ***
> Segmentation fault
> alex_at_singularity:~/huji/benchmarks/simple$
>
>
> Any ideas?
>
>
> On 03/02/2012 01:26 PM, Alex Margolin wrote:
>> Hi,
>>
>> I'm trying to replace the poll() function with mine (say poll2() in poll2.c), and I got some building errors.
>> This is after I copied poll2.c into opal/events/ and added it in the sources list in Makefile.am in that folder.
>>
>> ...
>> Making all in tools/wrappers
>> make[2]: Entering directory
>> `/home/alex/huji/openmpi-1.4.4/opal/tools/wrappers'
>> depbase=`echo opal_wrapper.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
>> gcc "-DEXEEXT=\"\"" -I. -I../../../opal/include -I../../../orte/include
>> -I../../../ompi/include
>> -I../../../opal/mca/paffinity/linux/plpa/src/libplpa -I../../.. -O3
>> -DNDEBUG -m64 -finline-functions -fno-strict-aliasing -pthread
>> -fvisibility=hidden -MT opal_wrapper.o -MD -MP -MF $depbase.Tpo -c -o
>> opal_wrapper.o opal_wrapper.c &&\
>> mv -f $depbase.Tpo $depbase.Po
>> opal_wrapper.c: In function ‘main’:
>> opal_wrapper.c:733:21: warning: ignoring return value of ‘asprintf’,
>> declared with attribute warn_unused_result [-Wunused-result]
>> opal_wrapper.c: In function ‘data_init’:
>> opal_wrapper.c:375:13: warning: ignoring return value of ‘asprintf’,
>> declared with attribute warn_unused_result [-Wunused-result]
>> opal_wrapper.c: In function ‘data_callback’:
>> opal_wrapper.c:333:25: warning: ignoring return value of ‘asprintf’,
>> declared with attribute warn_unused_result [-Wunused-result]
>> opal_wrapper.c:358:21: warning: ignoring return value of ‘asprintf’,
>> declared with attribute warn_unused_result [-Wunused-result]
>> opal_wrapper.c: In function ‘add_extra_includes’:
>> opal_wrapper.c:233:17: warning: ignoring return value of ‘asprintf’,
>> declared with attribute warn_unused_result [-Wunused-result]
>> opal_wrapper.c: In function ‘load_env_data’:
>> opal_wrapper.c:429:13: warning: ignoring return value of ‘asprintf’,
>> declared with attribute warn_unused_result [-Wunused-result]
>> opal_wrapper.c:432:17: warning: ignoring return value of ‘asprintf’,
>> declared with attribute warn_unused_result [-Wunused-result]
>> opal_wrapper.c: In function ‘load_env_data_argv’:
>> opal_wrapper.c:453:13: warning: ignoring return value of ‘asprintf’,
>> declared with attribute warn_unused_result [-Wunused-result]
>> opal_wrapper.c:456:17: warning: ignoring return value of ‘asprintf’,
>> declared with attribute warn_unused_result [-Wunused-result]
>> /bin/bash ../../../libtool --tag=CC --mode=link gcc -O3 -DNDEBUG -m64
>> -finline-functions -fno-strict-aliasing -pthread -fvisibility=hidden
>> -export-dynamic -o opal_wrapper opal_wrapper.o
>> ../../../opal/libopen-pal.la -lnsl -lutil -lm
>> libtool: link: gcc -O3 -DNDEBUG -m64 -finline-functions
>> -fno-strict-aliasing -pthread -fvisibility=hidden -o .libs/opal_wrapper
>> opal_wrapper.o -Wl,--export-dynamic ../../../opal/.libs/libopen-pal.so
>> -ldl -lnsl -lutil -lm -pthread -Wl,-rpath -Wl,/home/alex/huji/ompi4/lib
>> ../../../opal/.libs/libopen-pal.so: undefined reference to `poll2'
>> collect2: ld returned 1 exit status
>> make[2]: *** [opal_wrapper] Error 1
>> make[2]: Leaving directory
>> `/home/alex/huji/openmpi-1.4.4/opal/tools/wrappers'
>> make[1]: *** [all-recursive] Error 1
>> make[1]: Leaving directory `/home/alex/huji/openmpi-1.4.4/opal'
>> make: *** [all-recursive] Error 1
>> alex_at_singularity:~/huji/openmpi-1.4.4$
>>
>> It seems that I need to add poll2.c to OMPI_LIBEVENT_SOURCES, but I can't find it anywhere other then Makefile files, which are regenerated...
>> Am I missing something?
>>
>> I know trying to replace poll() seems like I'm doing something very wrong, but I want to poll on events without a valid linux file descriptor (and existing events, specifically sockets, at the same time), and I see no other way. Obviously, my poll2 calls the linux poll in most cases.
>>
>> Thanks,
>> Alex
>
> _______________________________________________
> devel mailing list
> devel_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/devel

-- 
Jeff Squyres
jsquyres_at_[hidden]
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/