Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D24AE200C79 for ; Fri, 5 May 2017 06:56:12 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CC7E5160BC4; Fri, 5 May 2017 04:56:12 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E9CF5160BB0 for ; Fri, 5 May 2017 06:56:11 +0200 (CEST) Received: (qmail 89364 invoked by uid 500); 5 May 2017 04:56:11 -0000 Mailing-List: contact dev-help@systemml.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@systemml.incubator.apache.org Delivered-To: mailing list dev@systemml.incubator.apache.org Received: (qmail 89352 invoked by uid 99); 5 May 2017 04:56:10 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 May 2017 04:56:10 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 529DE1AA2E1 for ; Fri, 5 May 2017 04:56:10 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.397 X-Spam-Level: X-Spam-Status: No, score=-0.397 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-2.796, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=eng.ucsd.edu Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id vVD08a6sCIuJ for ; Fri, 5 May 2017 04:56:08 +0000 (UTC) Received: from mail-wr0-f176.google.com (mail-wr0-f176.google.com [209.85.128.176]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 7EB4C5FB48 for ; Fri, 5 May 2017 04:56:07 +0000 (UTC) Received: by mail-wr0-f176.google.com with SMTP id l9so17411601wre.1 for ; Thu, 04 May 2017 21:56:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eng.ucsd.edu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=Xzvq43SJjBeYNPMJvcY+i7L1/5e73hoI0NT/y1CKjyg=; b=SDgqcYSXFKmYRR4BKVz8oxy5LPxrZm+8lCCc5NGjqMhNN5ITjRPJI7buhlhUXYl4W3 d8dkOrBamdRkjxiUVprG5H7X9WA+zTwjiQST1Biza6169v38XSXYqspRYByDxItQzIHy asB/VOt7o1bJF/d+n9sT5Xrj8yUNHz0gbo4Es= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=Xzvq43SJjBeYNPMJvcY+i7L1/5e73hoI0NT/y1CKjyg=; b=Y53TVS6r9ewTYQREPmeEITS7Giz+uu8BUc+pwhFuu/Ipx8qW6rW4O1jXhFzo1CF2aS wmVh3z6LReJcx5f5MHvdjTY4m7sJZdglGlq25WC8UrQBOCRLfu7f3XKEqrjY46nxDw10 XkvoGUwforRJaVYzUBddA/C3yg9EvClRNL7drMc1Dp7A19Hre46bNM8iDpdgPxrzmkpO v0PC+ZAGlPj352rBqeMMo0j68qdHGVwBn8xDBMp5N/qjE4lTWjarv3doy03oo0+uv4jm 1oZ6xRCEqLyDQ5PYSs9STzy4Yra9B78ESvyWBOfjWDGWcSpYhZrxo59f5U0NWCl7ev9k iHmw== X-Gm-Message-State: AN3rC/7H7VMH3d6g7VGaOQOryLp8yQzZZYH3d3mg2q9QZSirsycfsKK1 i0V50o49aVX9XOtSTQHAf531e/qVXWOP X-Received: by 10.223.139.199 with SMTP id w7mr21759934wra.92.1493960166203; Thu, 04 May 2017 21:56:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Mingyang Wang Date: Fri, 05 May 2017 04:55:55 +0000 Message-ID: Subject: Re: Sparse Matrix Storage Consumption Issue To: dev@systemml.incubator.apache.org Content-Type: multipart/alternative; boundary=f403045ea0a0042845054ebfb569 archived-at: Fri, 05 May 2017 04:56:13 -0000 --f403045ea0a0042845054ebfb569 Content-Type: text/plain; charset=UTF-8 Out of curiosity, I increased the driver memory to 10GB, and then all operations were executed on CP. It took 37.166s but JVM GC took 30.534s. I was wondering whether this is the expected behavior? Total elapsed time: 38.093 sec. Total compilation time: 0.926 sec. Total execution time: 37.166 sec. Number of compiled Spark inst: 0. Number of executed Spark inst: 0. Cache hits (Mem, WB, FS, HDFS): 0/0/0/1. Cache writes (WB, FS, HDFS): 0/0/0. Cache times (ACQr/m, RLS, EXP): 30.400/0.000/0.001/0.000 sec. HOP DAGs recompiled (PRED, SB): 0/0. HOP DAGs recompile time: 0.000 sec. Spark ctx create time (lazy): 0.000 sec. Spark trans counts (par,bc,col):0/0/0. Spark trans times (par,bc,col): 0.000/0.000/0.000 secs. Total JIT compile time: 22.302 sec. Total JVM GC count: 11. Total JVM GC time: 30.534 sec. Heavy hitter instructions (name, time, count): -- 1) uak+ 37.166 sec 1 -- 2) == 0.001 sec 1 -- 3) + 0.000 sec 1 -- 4) print 0.000 sec 1 -- 5) rmvar 0.000 sec 5 -- 6) createvar 0.000 sec 1 -- 7) assignvar 0.000 sec 1 -- 8) cpvar 0.000 sec 1 Regards, Mingyang On Thu, May 4, 2017 at 9:48 PM Mingyang Wang wrote: > Hi Matthias, > > Thanks for the patch. > > I have re-run the experiment and observed that there was indeed no more > memory pressure, but it still took ~90s for this simple script. I was > wondering what is the bottleneck for this case? > > > Total elapsed time: 94.800 sec. > Total compilation time: 1.826 sec. > Total execution time: 92.974 sec. > Number of compiled Spark inst: 2. > Number of executed Spark inst: 2. > Cache hits (Mem, WB, FS, HDFS): 1/0/0/0. > Cache writes (WB, FS, HDFS): 0/0/0. > Cache times (ACQr/m, RLS, EXP): 0.000/0.000/0.000/0.000 sec. > HOP DAGs recompiled (PRED, SB): 0/0. > HOP DAGs recompile time: 0.000 sec. > Spark ctx create time (lazy): 0.860 sec. > Spark trans counts (par,bc,col):0/0/0. > Spark trans times (par,bc,col): 0.000/0.000/0.000 secs. > Total JIT compile time: 3.498 sec. > Total JVM GC count: 5. > Total JVM GC time: 0.064 sec. > Heavy hitter instructions (name, time, count): > -- 1) sp_uak+ 92.597 sec 1 > -- 2) sp_chkpoint 0.377 sec 1 > -- 3) == 0.001 sec 1 > -- 4) print 0.000 sec 1 > -- 5) + 0.000 sec 1 > -- 6) castdts 0.000 sec 1 > -- 7) createvar 0.000 sec 3 > -- 8) rmvar 0.000 sec 7 > -- 9) assignvar 0.000 sec 1 > -- 10) cpvar 0.000 sec 1 > > Regards, > Mingyang > > On Wed, May 3, 2017 at 8:54 AM Matthias Boehm > wrote: > >> to summarize, this was an issue of selecting serialized representations >> for large ultra-sparse matrices. Thanks again for sharing your feedback >> with us. >> >> 1) In-memory representation: In CSR every non-zero will require 12 bytes >> - this is 240MB in your case. The overall memory consumption, however, >> depends on the distribution of non-zeros: In CSR, each block with at >> least one non-zero requires 4KB for row pointers. Assuming uniform >> distribution (the worst case), this gives us 80GB. This is likely the >> problem here. Every empty block would have an overhead of 44Bytes but >> for the worst-case assumption, there are no empty blocks left. We do not >> use COO for checkpoints because it would slow down subsequent operations. >> >> 2) Serialized/on-disk representation: For sparse datasets that are >> expected to exceed aggregate memory, we used to use a serialized >> representation (with storage level MEM_AND_DISK_SER) which uses sparse, >> ultra-sparse, or empty representations. In this form, ultra-sparse >> blocks require 9 + 16*nnz bytes and empty blocks require 9 bytes. >> Therefore, with this representation selected, you're dataset should >> easily fit in aggregate memory. Also, note that chkpoint is only a >> transformation that persists the rdd, the subsequent operation then >> pulls the data into memory. >> >> At a high-level this was a bug. We missed ultra-sparse representations >> when introducing an improvement that stores sparse matrices in MCSR >> format in CSR format on checkpoints which eliminated the need to use a >> serialized storage level. I just deliver a fix. Now we store such >> ultra-sparse matrices again in serialized form which should >> significantly reduce the memory pressure. >> >> Regards, >> Matthias >> >> On 5/3/2017 9:38 AM, Mingyang Wang wrote: >> > Hi all, >> > >> > I was playing with a super sparse matrix FK, 2e7 by 1e6, with only one >> > non-zero value on each row, that is 2e7 non-zero values in total. >> > >> > With driver memory of 1GB and executor memory of 100GB, I found the HOP >> > "Spark chkpoint", which is used to pin the FK matrix in memory, is >> really >> > expensive, as it invokes lots of disk operations. >> > >> > FK is stored in binary format with 24 blocks, each block is ~45MB, and >> ~1GB >> > in total. >> > >> > For example, with the script as >> > >> > """ >> > FK = read($FK) >> > print("Sum of FK = " + sum(FK)) >> > """ >> > >> > things worked fine, and it took ~8s. >> > >> > While with the script as >> > >> > """ >> > FK = read($FK) >> > if (1 == 1) {} >> > print("Sum of FK = " + sum(FK)) >> > """ >> > >> > things changed. It took ~92s and I observed lots of disk spills from >> logs. >> > Based on the stats from Spark UI, it seems the materialized FK requires >> >> 54GB storage and thus introduces disk operations. >> > >> > I was wondering, is this the expected behavior of a super sparse matrix? >> > >> > >> > Regards, >> > Mingyang >> > >> > --f403045ea0a0042845054ebfb569--