Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Goswin von Brederlow <goswin-v-b@web.de>
To: Nicolas Ojeda Bar <N.Ojeda.Bar@dpmms.cam.ac.uk>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Bigarray.map_file with large files?
Date: Tue, 5 Nov 2013 20:52:29 +0100	[thread overview]
Message-ID: <20131105195229.GC16998@frosties> (raw)
In-Reply-To: <A9F55FE1-5F82-427D-84B6-AEB33B5B9039@dpmms.cam.ac.uk>

On Tue, Nov 05, 2013 at 07:10:24PM +0000, Nicolas Ojeda Bar wrote:
> Dear list,
> 
> Is it correct that one cannot map large files (> 2GB in 32-bit systems) using Bigarray.map_file?
> Is there any way around this?
> 
> Thank you very much,
> Nicolas

You can map large files just fine. The Bigarray.Array1.map_file takes
a "?pos:int64" argument.

BUT you can only have 2GB memory total on a 32-bit system with a 1:1
(obsolete) split, 3GB with 3:1 split and 3.99GB with a 32-bit thread
on a 64-bit kernel. So you can only map a 1.9G/2.9G/3.9G chunk (or
multiple smaller ones) at a time. So this doesn't help you that much I
bet.


You have to map and unmap the file in chunks and juggle them manually.
There simply is not enough address space available in 32-bit.

You could write (or google for) a wrapper class around Bigarray that
mmaps/munmaps chunks of files on demand. You would have to use an
Int64 as index variable.

MfG
	Goswin

      reply	other threads:[~2013-11-05 19:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-05 19:10 Nicolas Ojeda Bar
2013-11-05 19:52 ` Goswin von Brederlow [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131105195229.GC16998@frosties \
    --to=goswin-v-b@web.de \
    --cc=N.Ojeda.Bar@dpmms.cam.ac.uk \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox