From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by sourceware.org (Postfix) with ESMTPS id 2DCBE3858D28; Wed, 3 Jan 2024 09:14:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2DCBE3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2DCBE3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=134.134.136.24 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704273269; cv=none; b=DihGSFTP2xHGhe6FmOBg7ru+CFSsutVa8EtvUcbPwl/sT22Otnn659QI8R1Ud+qwFfeVryeBqtm4IU4C9z5nUpUCM+gbDlAdC7YAMo3g2cWPmOWkpT9xjmliHk1wADfcxjRc1eaOjzlKnC/M6N9KhMIbcUUawpah/aWzLoERbko= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704273269; c=relaxed/simple; bh=CrzSZYQf6aMBqbTsMGbGt20Y1pc7sRXyMEbAHNzT1Z0=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=htksidVMk6I/tJSYcNuFZdDROFqgElzuRkpBnTstfI5UMgIHlFAnt8ml5p4MnYcdCgD5KjmWQpewSTEXYGPrjHnl5kV6DLzdhFM8DtMLLtX4G4UnzcWb5gjs3ABNjpvn3jfmh7BcXG/QL+VH8eQOkPl/2BNCvvWoB4RiBQB2hL0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704273267; x=1735809267; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=CrzSZYQf6aMBqbTsMGbGt20Y1pc7sRXyMEbAHNzT1Z0=; b=CIiV2/c22DGzW9pj6fguZae/vTvYKLvy/cXRP4QikE17W1QdLCXiNtti MPkSF6VRmqSHpI23L43yc3lbHH40DWnbh1E73s+NSfhIkH5jIwbZdURk9 pv3UvEK2SQKElD5gROoEVvpEkC7imOWOS9JTWm/v3BPxyQPg9DiyAJfek D8SHOydohIADvdTIgXnaTEOJGhJpfOgJJRqPwSNSNhzHdyIDBSwWIFg+T BJHvXbcy3xn7m92+Ytya81x3hde9oTFoJ/yYNaurV7LkwKDISUu/zSIYO tdZbmVjQ7vJa+FEHBDznV2rRpXAGoehaL9iN5MhIjf0SUDewux+xci+ZV g==; X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="399756501" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="399756501" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jan 2024 01:14:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="21733252" Received: from zhulipeng-win.ccr.corp.intel.com (HELO [10.238.1.222]) ([10.238.1.222]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jan 2024 01:14:16 -0800 Message-ID: <36133fcc-5cb7-48aa-8bee-20634fd1d1de@intel.com> Date: Wed, 3 Jan 2024 17:14:13 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: RE: [PATCH v7] libgfortran: Replace mutex with rwlock Content-Language: en-US To: Thomas Schwinge , "H.J. Lu" Cc: Jakub Jelinek , fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org, "Deng, Pan" , rep.dot.nop@gmail.com, "Li, Tianyou" , tkoenig@netcologne.de, "Guo, Wangyang" , Tobias Burnus References: <20231209153944.3746165-1-lipeng.zhu@intel.com> <87sf45su42.fsf@euler.schwinge.homeip.net> <87bkajsrx4.fsf@euler.schwinge.homeip.net> From: Lipeng Zhu Organization: Intel In-Reply-To: <87bkajsrx4.fsf@euler.schwinge.homeip.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2023/12/21 19:42, Thomas Schwinge wrote: > Hi! > > On 2023-12-13T21:52:29+0100, I wrote: >> On 2023-12-12T02:05:26+0000, "Zhu, Lipeng" wrote: >>> On 2023/12/12 1:45, H.J. Lu wrote: >>>> On Sat, Dec 9, 2023 at 7:25 PM Zhu, Lipeng wrote: >>>>> On 2023/12/9 23:23, Jakub Jelinek wrote: >>>>>> On Sat, Dec 09, 2023 at 10:39:45AM -0500, Lipeng Zhu wrote: >>>>>>> This patch try to introduce the rwlock and split the read/write to >>>>>>> unit_root tree and unit_cache with rwlock instead of the mutex to >>>>>>> increase CPU efficiency. In the get_gfc_unit function, the >>>>>>> percentage to step into the insert_unit function is around 30%, in >>>>>>> most instances, we can get the unit in the phase of reading the >>>>>>> unit_cache or unit_root tree. So split the read/write phase by >>>>>>> rwlock would be an approach to make it more parallel. >>>>>>> >>>>>>> BTW, the IPC metrics can gain around 9x in our test server with >>>>>>> 220 cores. The benchmark we used is >>>>>>> https://github.com/rwesson/NEAT >> >>>>>> Ok for trunk, thanks. >> >>>>> Thanks! Looking forward to landing to trunk. >> >>>> Pushed for you. > >> I've just filed >> "'libgomp.fortran/rwlock_1.f90', 'libgomp.fortran/rwlock_3.f90' execution test timeouts". >> Would you be able to look into that? > > See my update in there. > > > Grüße > Thomas > ----------------- > Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 > Updated in https://gcc.gnu.org/PR113005. Could you help to verify if the draft patch would fix the execution test timeout issue on your side? diff --git a/libgomp/testsuite/libgomp.fortran/rwlock_1.f90 b/libgomp/testsuite/libgomp.fortran/rwlock_1.f90 index f90ecbeb00f..1c271ae031d 100644 --- a/libgomp/testsuite/libgomp.fortran/rwlock_1.f90 +++ b/libgomp/testsuite/libgomp.fortran/rwlock_1.f90 @@ -7,13 +7,12 @@ program main use omp_lib implicit none integer:: unit_number, v1, v2, i - character(11) :: file_name + character(16) :: file_name character(3) :: async = "no" !$omp parallel private (unit_number, v1, v2, file_name, async, i) do i = 0, 100 unit_number = 10 + omp_get_thread_num () - write (file_name, "(I3, A)") unit_number, "_tst.dat" - file_name = adjustl(file_name) + write (file_name, "(I5.5, A)") unit_number, "_tst.dat" open (unit_number, file=file_name, asynchronous="yes") ! call inquire with file parameter to test find_file in unix.c inquire (file=file_name, asynchronous=async) Lipeng Zhu