From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7F37C3858C50; Mon, 23 Jan 2023 14:59:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F37C3858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674485962; bh=HCfDihmFNWNMG1ZxvHpsxLPBB8VAYFXz7FKy9OOtLJU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XLi0UErKWBBEjAIvh/l2Ou4ySL4pom94KD2ciWityzTFd2cik0wfTIxg8td+r/uvZ 1kQ/Yd0vwy1g/4dKBdeZnw0iPhkPcACbPDhQqmGEBFMG0Wu5qA9dCADZZ6DiniMUWu 46LVvE8wVYZJBk7kbvzCLoxqHIodByYVNzSc6sOM= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libgomp/108494] Slow thread creation with nested loops in GFortran Date: Mon, 23 Jan 2023 14:59:21 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libgomp X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: openmp X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108494 --- Comment #3 from Jakub Jelinek --- Yeah, we only cache threads at the outermost parallelism level, for nested parallelism threads are created and destructed as needed. I know libomp basically never destroys threads (except for omp_pause_resource{,_all}?), but am not convinced that is a good idea resource-wise, while it makes pointless benchmarks faster, whenever some program uses nested parallelism for a short time say from some library once= and then doesn't need it anymore, it will just waste resources. Most programs don't use omp_pause_resource{,_all} and especially in librari= es it is pretty impossible because the library doesn't know if some other part= of the program doesn't actually use OpenMP.=