delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/11/17/14:34:03

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 4AHJY3EI2315602
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 4AHJY3EI2315602
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=K40MaYFA
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 69C3D3856942
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1731872041;
bh=x4Iu8RwN/r06zkTOR5dDDVa5xlQeFT+xqgv+or4oZqw=;
h=Date:To:Subject:References:List-Id:List-Unsubscribe:List-Archive:
List-Post:List-Help:List-Subscribe:From:Reply-To:From;
b=K40MaYFALvvc2NHF7FEPteS7sIljzISoJb8Fl1+OosaX8719d9SoABpfjySgAFZqw
ov9hW7vET3sEMV52t5X3IoYe8ibN7fMlbQ4nGbDYylxvyUuvmaz4oXmV5agwl36HTd
zv9Yav7ZkK+lBWCA4eiISAGZ7/45HBv093b6T6sA=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1AADA3857341
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1AADA3857341
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1731871981; cv=none;
b=HGdVcY0FpvTUtpV6GxSekxoFIygaWiAB6NtE5DFv8UA0J2Epx03DEgGsjZPRBzw8gAPfq58npR0fvl90KOSp0IqRhXVjGUS1U7gBdKjrivS20pVuI6O64/1AsRee5zHFHDeO3JhcdlxcP2Gt/27ucb+JbR3fiAMOQZsriY/+2QA=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1731871981; c=relaxed/simple;
bh=tDuZgPw2+BFz2te31yattvqN5PShRTo6+h4HuFlBwQI=;
h=DKIM-Signature:Date:From:To:Message-ID:Subject:MIME-Version;
b=VIqzaE+qh04saxSIS8VYH2lROdc395IxhhHIUELqiELVMgfi1HkBjGYYPIvhaFRC2LIRmx0CytSs/KGxKvEUj5yFPWn8j5MCN1RPl24FeDknWafjfJhZTipD/MTGe0zaq/hqNZ4a/6npMRqJLfc5flzVW2EBTWD3JAtO7ELVk6Q=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1AADA3857341
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
t=1731871980; bh=PIS/0YsaG6O2HBT/JM1pvRiIaEZSgKvcpQT0QR7CLMR=;
h=X-Sonic-MF:Date:From:To:Subject:From:Subject;
b=RHKvBgNBphxAvaLqPKdNXcsrykeU9u+Mv1TMdk0m0fqPPyHtJ4XGSseUQ+ikdsWNiQsTwQ/3odPu8y/ZU8Nncjandb6aoX884OlQSfsFqTTB6eRhfUaZZmxdwNzsfpJzDhdoz9XP37wbzUi3eXI0xinnp0EfTuE+/IqvH1N5UOKBu2zNxjPG1L3UYi5loNcJc+OM/oGwU2YNOO9L9yk19gcbyzVvnm63obX01ixWuqDO/oB+a+ZP5d81vmG2M9kar3T3WSBkPJN+aBK3AHQnKXYMUZzgbSSJSWQq+Qxx9IHA/C3q8dgM/SYZOF5fVx+9KCDI+4MNomk1/wcc7AuMTA==
X-YMail-OSG: BfVFkx4VM1nhYBFG_QOsVgDZhDEexBj4E4MYBJLlQJ35.d6kYfjyXPl8qb3SfbL
7oBj9apdoVNPeHKxSO4GqUcrCnHRSGhnrK2GjB70VgbPO4JBXu8Ne7K5CjOytrt3TSJprL_yxJ1G
PJcR4RjtJOm0iwF7fvuHvVZ5ijcR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mSffp6mmy9moZPB4VsZIXjYrwiuczGQTrddj9EIAzMCV2cz50C3pNfOcXVWyafOBVujMjW
pc8opb8AJW1rl8BlKwec-
X-Sonic-MF: <stinkf42 AT yahoo DOT com>
X-Sonic-ID: d33f0f8c-2c5a-45d0-932d-ce9e4e3cb257
Date: Sun, 17 Nov 2024 19:32:58 +0000 (UTC)
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Message-ID: <791865992.3601338.1731871978376@mail.yahoo.com>
Subject: Thread memory allocation issue
MIME-Version: 1.0
References: <791865992 DOT 3601338 DOT 1731871978376 DOT ref AT mail DOT yahoo DOT com>
X-Mailer: WebService/1.1.22876 YMailNorrin
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Teepean via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Teepean <stinkf42 AT yahoo DOT com>
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 4AHJY3EI2315602

Hello!

I raised this issue couple of years ago on cygwin-developer but now when the problem has manifested again with recent versions of Cygwin I decided to post this to general discussion list.

Steps to Reproduce

1. Compile BWA normally

https://github.com/lh3/bwa/

2. Compile BWA with rpmalloc and the following patch:


// In thread worker function:
#ifdef __CYGWIN__
rpmalloc_thread_initialize();
#endif


// ... thread work ...
#ifdef __CYGWIN__
rpmalloc_thread_finalize(1);
#endif


3. Run both versions with the following command:
time ./bwa mem -t 11 chr19_KI270866v1_alt.fasta test_1.fastq test_2.fastq > testorigsingle.sam


Without Patch (Default malloc):


[M::mem_process_seqs] Processed 120000 reads in 30.296 CPU sec, 3.743 real sec
[main] Real time: 3.883 sec; CPU: 30.436 sec
real    0m3.907s
user    0m19.186s
sys     0m11.265s


With Patch (rpmalloc):


[M::mem_process_seqs] Processed 120000 reads in 7.530 CPU sec, 0.702 real sec
[main] Real time: 0.830 sec; CPU: 7.640 sec
real    0m0.868s
user    0m7.343s
sys     0m0.327s


Analysis

1. The default malloc implementation shows extremely high system time (11.265s) compared to the rpmalloc version (0.327s)
2. Total real time is about 4.5x slower with default malloc
3. The dramatic difference in system time suggests heavy contention in the memory allocation subsystem
4. The issue only manifests on Cygwin with bwa; the same code performs normally on native Linux and MacOS
5. The issue manifests with recent versions of Cygwin but does work with older versions

The issue becomes more pronounced with higher thread counts


The patched code is located here in branch Cygwin:


https://github.com/WGSExtract/bwa.git


Simple testsuite. Run bash testsuite.sh. The testsuite includes a version compiled with an older version of Cygwin called bwa_working.exe


https://drive.google.com/file/d/1jtbQVUAcCmpJM-8Exi0C6pzDXcEo4cV6/view?usp=drive_link

Regards,
Teemu Nätkinniemi

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019