[PATCH v7] libgfortran: Replace mutex with rwlock
Lipeng Zhu
lipeng.zhu@intel.com
Wed Jan 3 09:14:13 GMT 2024
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" <lipeng.zhu@intel.com> wrote:
>>> On 2023/12/12 1:45, H.J. Lu wrote:
>>>> On Sat, Dec 9, 2023 at 7:25 PM Zhu, Lipeng <lipeng.zhu@intel.com> 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 <https://gcc.gnu.org/PR113005>
>> "'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
More information about the Fortran
mailing list