Re: large and sparse matrices
- From: Kenneth Brody <kenbrody@xxxxxxxxxxx>
- Date: Fri, 11 May 2007 12:45:25 -0400
"mediratta@xxxxxxxxx" wrote:
[...]
Hi,
I want to allocate memory for a large matrix, whose size will be
around 2.5 million x 17000. Three fourth of its rows will have all
zeroes, but it is not known which will be those rows. If I try to
allocate memory for this huge array, then I get a segmentation fault
saying:
Program received signal SIGSEGV, Segmentation fault.
0xb7dd5226 in mallopt () from /lib/tls/i686/cmov/libc.so.6
I have not given any compiler options. I think that the error is
because I am allocating too big a size ?
Rather than attempting to allocate one huge array, allocate an
array of pointers to each row. (Are there 2.5 million rows, or
17,000 rows?) Initialize this array with NULL pointers. Then
allocate each row only as they're used.
However, even then, how much memory is needed for one fourth of
the rows? You are talking about 42.5 billion entries, so one
fourth of them occupied is still over 10 billion entries. Given
that your system (i386 Linux) has only 32 bits of address, that
means 4 billion addresses. Obviously, you cannot address 10
billion entries in 32 bits.
It sounds like you'll need to do some bookkeeping on your end to
keep rows on disk (in separate files -- again for the 32-bit
limit on your system) and swap them in and out as needed.
And you better hope that you have enough disk space for all of
this data as well.
--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:ThisIsASpamTrap@xxxxxxxxx>
.
- References:
- large and sparse matrices
- From: mediratta@xxxxxxxxx
- large and sparse matrices
- Prev by Date: Re: Problem with free()
- Next by Date: Re: Problem with free()
- Previous by thread: Re: large and sparse matrices
- Next by thread: scanf() quesion?
- Index(es):
Relevant Pages
|