<div dir="ltr">Forward my previous reply to the everyone.<br><div><div><div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">---------- Forwarded message ---------<br>From: <b class="gmail_sendername" dir="auto">Houjun Tang</b> <span dir="ltr"><<a href="mailto:htang4@lbl.gov" target="_blank">htang4@lbl.gov</a>></span><br>Date: Thu, Apr 25, 2019 at 1:19 PM<br>Subject: Re: [argobots-discuss] Argobots ABT_eventual_set too slow<br>To: <<a href="mailto:discuss@lists.argobots.org" target="_blank">discuss@lists.argobots.org</a>><br>Cc: Quincey Koziol <<a href="mailto:koziol@lbl.gov" target="_blank">koziol@lbl.gov</a>>, Balaji, Pavan <<a href="mailto:balaji@anl.gov" target="_blank">balaji@anl.gov</a>>, Houjun Tang via discuss <<a href="mailto:discuss@lists.argobots.org" target="_blank">discuss@lists.argobots.org</a>><br></div><br><br><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hi all,</div><div><br></div><div>On Phil's earlier question, my code that uses Argobots is not compiled with OpenMP, it's only the application code that by default enables OpenMP. <br></div><div><br></div><div>I have tried different things as you suggested, and it seems setting <font face="Calibri, Arial, Helvetica, sans-serif, serif, EmojiFont"><font face="Calibri, Arial, Helvetica, sans-serif, serif, EmojiFont">OMP_PROC_BIND=false (previously it is set to "spread") can solve the problem. With that variable set, ABT_eventual_set() takes similar time (under 0.00001 seconds) to when OpenMP is disabled. So maybe it's because the Argobots threads and OpenMP threads are executing on the same core and causes the slowdown?</font></font></div><div><font face="Calibri, Arial, Helvetica, sans-serif, serif, EmojiFont"><font face="Calibri, Arial, Helvetica, sans-serif, serif, EmojiFont"><br></font></font></div><div><font face="Calibri, Arial, Helvetica, sans-serif, serif, EmojiFont"><font face="Calibri, Arial, Helvetica, sans-serif, serif, EmojiFont"><br></font></font></div><div><font face="Calibri, Arial, Helvetica, sans-serif, serif, EmojiFont"><font face="Calibri, Arial, Helvetica, sans-serif, serif, EmojiFont">Thanks,</font></font></div><div><font face="Calibri, Arial, Helvetica, sans-serif, serif, EmojiFont"><font face="Calibri, Arial, Helvetica, sans-serif, serif, EmojiFont">Houjun Tang<br></font></font></div><div><br></div><div><br></div><div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 25, 2019 at 9:57 AM Balaji, Pavan via discuss <<a href="mailto:discuss@lists.argobots.org" target="_blank">discuss@lists.argobots.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Quincey,<br>
<br>
As I mentioned in my other email, maybe my guess wasn't correct. We should dig a bit deeper to figure it out.<br>
<br>
FYI, BOLT is an implementation of the Intel OpenMP runtime API on top of Argobots. It doesn't change the compiler, and is a simple LD_PRELOAD for your already compiled applications. You can still use ICC, Clang, GCC, etc. You should try it out.<br>
<br>
-- Pavan<br>
<br>
> On Apr 25, 2019, at 10:12 AM, Quincey Koziol <<a href="mailto:koziol@lbl.gov" target="_blank">koziol@lbl.gov</a>> wrote:<br>
> <br>
> Hi Pavan,<br>
> So the BOLT version of OpenMP does lightweight threads? Is there any way to quiesce the OpenMP threads, so that they don’t have this level of impact when they aren’t executing code? Taking a core from OpenMP seems also reasonable - is it a runtime controllable thing? (i.e. with an API?)<br>
> <br>
> Quincey<br>
> <br>
> <br>
> <br>
>> On Apr 24, 2019, at 7:39 PM, Balaji, Pavan <<a href="mailto:balaji@anl.gov" target="_blank">balaji@anl.gov</a>> wrote:<br>
>> <br>
>> Quincey,<br>
>> <br>
>> My guess is that you are running into the same problem as general pthreads + OpenMP interoperability issues. That is, OpenMP is likely creating as many pthreads as the number of cores, leaving nothing for Argobots. You can also try to reduce the number of cores available to OpenMP. But that seems like a suboptimal solution. We ideally want all layers to create as many lightweight threads as possible, irrespective of the number of cores available.<br>
>> <br>
>> -- Pavan<br>
>> <br>
>>> On Apr 24, 2019, at 6:31 PM, Quincey Koziol <<a href="mailto:koziol@lbl.gov" target="_blank">koziol@lbl.gov</a>> wrote:<br>
>>> <br>
>>> Hi Pavan,<br>
>>> That might not be a very good option for general use, at facilities. Any ideas about how Argobots & OpenMP are conflicting here?<br>
>>> <br>
>>> Quincey<br>
>>> <br>
>>> <br>
>>>> On Apr 24, 2019, at 1:51 PM, Balaji, Pavan via discuss <<a href="mailto:discuss@lists.argobots.org" target="_blank">discuss@lists.argobots.org</a>> wrote:<br>
>>>> <br>
>>>> Houjun,<br>
>>>> <br>
>>>> You could try BOLT, which allows you to have OpenMP internally use Argobots too. So they won't conflict with each other.<br>
>>>> <br>
>>>> -- Pavan<br>
>>>> <br>
>>>>> On Apr 24, 2019, at 1:49 PM, Houjun Tang via discuss <<a href="mailto:discuss@lists.argobots.org" target="_blank">discuss@lists.argobots.org</a>> wrote:<br>
>>>>> <br>
>>>>> Hi,<br>
>>>>> <br>
>>>>> I think I found the what is causing the performance slowdown. My previous experiments were using the default application configuration, with OpenMP enabled. I've just tried to compile the application without OpenMP, and the performance gets much better, the ABT_eventual_set takes less than 0.00002 seconds in all operations. So it looks like running Argobots with OpenMP may sometimes cause a slowdown. Any idea on how to resolve this?<br>
>>>>> <br>
>>>>> <br>
>>>>> Thanks,<br>
>>>>> Houjun Tang<br>
>>>>> <br>
>>>>> On Tue, Apr 23, 2019 at 4:43 PM Houjun Tang <<a href="mailto:htang4@lbl.gov" target="_blank">htang4@lbl.gov</a>> wrote:<br>
>>>>> Hi Phil,<br>
>>>>> <br>
>>>>> Thanks for the suggestion. I'm using the basic scheduler, and have changed to ABT_SCHED_BASIC as you mentioned, but the issue remains. <br>
>>>>> <br>
>>>>> I've talked to Shintaro earlier this afternoon, and sent him my codes to run the experiments, hopefully we can figure out what was going on.<br>
>>>>> <br>
>>>>> <br>
>>>>> Thanks,<br>
>>>>> Houjun Tang<br>
>>>>> <br>
>>>>> On Tue, Apr 23, 2019 at 8:16 AM Carns, Philip H. <<a href="mailto:carns@mcs.anl.gov" target="_blank">carns@mcs.anl.gov</a>> wrote:<br>
>>>>> Hi Houjun,<br>
>>>>> <br>
>>>>> Which scheduler are you using with Argobots?<br>
>>>>> <br>
>>>>> If you can reproduce this easily it might be worth toggling between ABT_SCHED_BASIC and ABT_SCHED_BASIC_WAIT (whichever one you are not using) to narrow down a possible issue there. I don't expect a problem there, but something unusual must be going on. In my experience eventual_set() is an inexpensive call.<br>
>>>>> <br>
>>>>> thanks,<br>
>>>>> -Phil<br>
>>>>> From: Iwasaki, Shintaro via discuss <<a href="mailto:discuss@lists.argobots.org" target="_blank">discuss@lists.argobots.org</a>><br>
>>>>> Sent: Monday, April 22, 2019 9:45 AM<br>
>>>>> To: Houjun Tang<br>
>>>>> Cc: Iwasaki, Shintaro; <a href="mailto:discuss@lists.argobots.org" target="_blank">discuss@lists.argobots.org</a><br>
>>>>> Subject: Re: [argobots-discuss] Argobots ABT_eventual_set too slow<br>
>>>>> <br>
>>>>> Hi, Houjun,<br>
>>>>> <br>
>>>>> Thank you for your detailed explanation! There are two possible issues:<br>
>>>>> <br>
>>>>> 1. Because tasklet (= task) is nonpreemptive, the current Argobots-aware HDF5 code might fail to overlap communications. For example, ABT_eventual_set uses busy-wait based synchronization (<a href="https://github.com/pmodels/argobots/blob/master/src/eventual.c#L260" rel="noreferrer" target="_blank">https://github.com/pmodels/argobots/blob/master/src/eventual.c#L260</a>) if tasklet is used. If ULT (= thread) is used, it does user-level context-switch based synchronization (<a href="https://github.com/pmodels/argobots/blob/master/src/eventual.c#L257" rel="noreferrer" target="_blank">https://github.com/pmodels/argobots/blob/master/src/eventual.c#L257</a>). However, ultimately it depends on how the code is written. This problem should be addressed by changing the HDF5 implementation (e.g., by using ULTs properly), if this is the case.<br>
>>>>> <br>
>>>>> 2. Currently the Argobots eventual uses a simple linked list, which performs poorly if so many threads and tasks are waiting. This performance should be improved by more advanced management of waiting threads in the Argobots runtime.<br>
>>>>> <br>
>>>>> From your explanation, I can hardly get which problem is more significant; intuitively, this operation itself does not seem to consume 0.1 seconds or so (though it depends on how many tasks are in the linked list).<br>
>>>>> I am happy to examine your code if it is okay, but I would really appreciate it if you would give me a simplified code that reproduces your performance issue.<br>
>>>>> <br>
>>>>> Thank You,<br>
>>>>> Shintaro Iwasaki<br>
>>>>> <br>
>>>>> On Fri, Apr 19, 2019 at 5:57 PM Houjun Tang <<a href="mailto:htang4@lbl.gov" target="_blank">htang4@lbl.gov</a>> wrote:<br>
>>>>> Hi Shintaro,<br>
>>>>> <br>
>>>>> Thanks for the quick reply, here is a brief summary of what I have been working on.<br>
>>>>> I'm adding the asynchronous I/O feature to the HDF5 library using Argobots as the background thread execution engine. So whenever there is an HDF5 I/O call, the main thread will create an Argobots task (with ABT_task_create) and have it executed by Argobots in the background. Only one Argobots pool is used, so consecutive tasks are executed sequentially. The application code linked to the async HDF5 library is creating and writing a lot of HDF5 attributes, as seen in the figure I sent previously, the time taken by ABT_eventual_set varies greatly, from 2 us to 0.45 s with an average ~0.07s.<br>
>>>>> <br>
>>>>> Any additional information would you like to know? Do you want the code?<br>
>>>>> <br>
>>>>> <br>
>>>>> Regards,<br>
>>>>> Houjun Tang<br>
>>>>> <br>
>>>>> On Fri, Apr 19, 2019 at 2:11 PM Iwasaki, Shintaro via discuss <<a href="mailto:discuss@lists.argobots.org" target="_blank">discuss@lists.argobots.org</a>> wrote:<br>
>>>>> Hello Houjun,<br>
>>>>> <br>
>>>>> Thank you for reporting a performance issue with data!<br>
>>>>> Unfortunately, I haven't experienced this issue. I checked the code, but it is hard to judge if the implementation of ABT_eventual_set is bad or not. As far as I checked the implementation of ABT_eventual_set, this function does not looks very optimized (I mean, it uses a naive spinlock), but doe not seem very slow (I mean, it does not allocate memory every time).<br>
>>>>> <a href="https://github.com/pmodels/argobots/blob/master/src/eventual.c#L229" rel="noreferrer" target="_blank">https://github.com/pmodels/argobots/blob/master/src/eventual.c#L229</a><br>
>>>>> <br>
>>>>> In any case, this single operation should be finished within 1us or less (under no contention). I guess it might be caused by a scheduling issue or an affinity issue, but since the performance of this function has not been fully examined, the current implementation might have some performance bugs. I could diagnose this problem more if you would give me more details.<br>
>>>>> <br>
>>>>> Thank You,<br>
>>>>> Shintaro Iwasaki<br>
>>>>> <br>
>>>>> On Fri, Apr 19, 2019 at 2:56 PM Houjun Tang via discuss <<a href="mailto:discuss@lists.argobots.org" target="_blank">discuss@lists.argobots.org</a>> wrote:<br>
>>>>> Hi,<br>
>>>>> <br>
>>>>> I'm using Argobots as the engine for executing asynchronous I/O operations in the background of an HDF5 application, but found it to be slow in some operations. With profiling, the slowdown comes mostly from ABT_eventual_set. Below is a boxplot of the ABT_eventual_set time (measured by calling gettimeofday before and after it) from 385 operations, running with one process and one Argobots thread. The *_fn are different functions executed by Argobots. In most cases it's below 0.1s, but there are several cases that are taking more than 0.25 seconds. As these HDF5 operations take less than 0.1 seconds, the overhead of ABT_eventual_set becomes dominant. <br>
>>>>> <br>
>>>>> Any idea what could have caused this? <br>
>>>>> <br>
>>>>> Thanks,<br>
>>>>> Houjun Tang<br>
>>>>> <br>
>>>>> <br>
>>>>> _______________________________________________<br>
>>>>> discuss mailing list<br>
>>>>> <a href="mailto:discuss@lists.argobots.org" target="_blank">discuss@lists.argobots.org</a><br>
>>>>> <a href="https://lists.argobots.org/mailman/listinfo/discuss" rel="noreferrer" target="_blank">https://lists.argobots.org/mailman/listinfo/discuss</a><br>
>>>>> _______________________________________________<br>
>>>>> discuss mailing list<br>
>>>>> <a href="mailto:discuss@lists.argobots.org" target="_blank">discuss@lists.argobots.org</a><br>
>>>>> <a href="https://lists.argobots.org/mailman/listinfo/discuss" rel="noreferrer" target="_blank">https://lists.argobots.org/mailman/listinfo/discuss</a><br>
>>>>> _______________________________________________<br>
>>>>> discuss mailing list<br>
>>>>> <a href="mailto:discuss@lists.argobots.org" target="_blank">discuss@lists.argobots.org</a><br>
>>>>> <a href="https://lists.argobots.org/mailman/listinfo/discuss" rel="noreferrer" target="_blank">https://lists.argobots.org/mailman/listinfo/discuss</a><br>
>>>> <br>
>>>> _______________________________________________<br>
>>>> discuss mailing list<br>
>>>> <a href="mailto:discuss@lists.argobots.org" target="_blank">discuss@lists.argobots.org</a><br>
>>>> <a href="https://lists.argobots.org/mailman/listinfo/discuss" rel="noreferrer" target="_blank">https://lists.argobots.org/mailman/listinfo/discuss</a><br>
>>> <br>
>> <br>
> <br>
<br>
_______________________________________________<br>
discuss mailing list<br>
<a href="mailto:discuss@lists.argobots.org" target="_blank">discuss@lists.argobots.org</a><br>
<a href="https://lists.argobots.org/mailman/listinfo/discuss" rel="noreferrer" target="_blank">https://lists.argobots.org/mailman/listinfo/discuss</a><br>
</blockquote></div>
</div></div></div></div></div></div>