From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2747 invoked by alias); 5 Jun 2019 19:06:44 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 2739 invoked by uid 89); 5 Jun 2019 19:06:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-4.4 required=5.0 tests=AWL,BAYES_00,BODY_8BITS,FREEMAIL_FROM,GARBLED_BODY,GIT_PATCH_2,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=H*f:sk:ab3513b, H*i:sk:ab3513b X-HELO: mail-yb1-f174.google.com Received: from mail-yb1-f174.google.com (HELO mail-yb1-f174.google.com) (209.85.219.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Jun 2019 19:06:42 +0000 Received: by mail-yb1-f174.google.com with SMTP id y2so9726136ybo.3 for ; Wed, 05 Jun 2019 12:06:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=D9Kkso6wtflKYIOQyheF2U2HMXW9yL7orFmpF7eXX0Y=; b=PLK7MaMj5+5EdzEHgIijOL10yK7uGRIrZOJjanWvevgxgXzmUTyVT8BpDb18DmbgS5 qadPWh55e83FuFAVYlHbZ5GxOEJ38UV5QjGFX6+H21GQXlZ91cdCJ1QbmUlqTM3iCBbY pnjS/PUVljGxsbCUW6WAvL5QmdcorG2zcNxpnLEMEduBNhHI+aA+P6jhMSCHTu1GuLny MsHXsU0UjoESmv8O1UbtMBtDaDVccUthtXKwTo4tqXhRSQ6COW+ucGxlIhrOWlq7TAhL qDUNbE+AvoBYT9eBvcHNc2QwTUqfNk5phG1n/X6srFopvAkkxJTg8ibntePZk3DAAIST v6mQ== MIME-Version: 1.0 References: <20190603182101.GS19695@tucnak> In-Reply-To: From: Janne Blomqvist Date: Wed, 05 Jun 2019 19:06:00 -0000 Message-ID: Subject: Re: [GSoC'19, libgomp work-stealing] Task parallelism runtime To: =?UTF-8?B?6rmA6rec656Y?= Cc: gcc mailing list , Jakub Jelinek Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2019-06/txt/msg00029.txt.bz2 On Wed, Jun 5, 2019 at 9:25 PM =EA=B9=80=EA=B7=9C=EB=9E=98 wrote: > > Hi, thanks for the detailed explanation. > I think I now get the picture. > Judging from my current understanding, the task-parallelism currently wor= ks as follows: > 1. Tasks are placed in a global shared queue. > 2. Workers consume the tasks by bashing the queue in a while loop, just a= s self-scheduling (dynamic scheduling)/ > > Then the improvements including work-stealing must be done by: > 1. Each worker holds a dedicated task queue reducing the resource content= ion. > 2. The tasks are distributed in a round-robin fashion For nested task submission (does OpenMP support that?) you probably want to submit to the local queue rather than round-robin, no? > 3. work-stealing will resolve the load imbalance. > > If the above statements are correct, I guess the task priority should be = given some special treatment? > > Ray Kim > > -----Original Message----- > From: "Jakub Jelinek" > To: "=EA=B9=80=EA=B7=9C=EB=9E=98"; > Cc: ; > Sent: 2019-06-04 (=ED=99=94) 03:21:01 (GMT+09:00) > Subject: Re: [GSoC'19, libgomp work-stealing] Task parallelism runtime > > On Tue, Jun 04, 2019 at 03:01:13AM +0900, =EA=B9=80=EA=B7=9C=EB=9E=98 wro= te: > > Hi, > > I've been studying the libgomp task parallelism system. > > I have a few questions. > > First, Tracing the events shows that only the main thread calls GOMP_ta= sk. > > No, any thread can call GOMP_task, in particular the thread that encounte= red > the #pragma omp task construct. > > The GOMP_task function then decides based on the clauses of the construct > (passed in various ways through the arguments of that function) whether it > will be included (executed by the encountering thread), or queued for > later execution. In the latter case, it will be scheduled during a barri= er > (implicit or explicit), see gomp_barrier_handle_tasks called from the > bar.[ch] code, or at other spots, e.g. during taskwait construct > (GOMP_taskwait) or at the end of taskgroup (GOMP_taskgroup_end). > > > How do the other worker threads enter the libgomp runtime? > > If you never encounter a parallel, teams or target construct, then there = is > just one thread that does everything (well, the library is written such t= hat > if you by hand pthread_create, each such thread acts as a separate initial > thread from OpenMP POV). > Threads are created e.g. during parallel construct (GOMP_parallel), where > for non-nested parallelism as the standard requires it reuses existing > threads if possible or spawns new ones, see mainly team.c (gomp_team_star= t) > for the function that spawns new threads or awakes the ones waiting for > work, or gomp_thread_start in the same file for the function actually run= by > the libgomp library created threads. > > > I can't find the entry point of the worker threads from the event traci= ng and the assembly dump. > > Second, How is the task priority set? > > By the user, through priority clause, passed to GOMP_task and then taken > into account when handling tasks in the various queues. > > Jakub --=20 Janne Blomqvist