Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

3 dimensional array 2

Status
Not open for further replies.

Naresh20

Technical User
Mar 1, 2012
4
FR
Hi all,
I am using Fortran for my work.
I have a very big 3 dimensional array in my code. when i tried to compile it using gfortran, i got an error message -"relocation truncated to fit: R_X86_64_32S against `.bss" . I realized that it is due to the huge amount of memory to be used (> 2GB) and hence used -mcmodel=medium and the compilation was successfulL. But when i try to run the *.exe, it is getting killed by ZSH. Can anyone help me to figure this out. The dimension of the array is Array[10000,50000,50000]. I know that the array size large but i have to use this for my work ;-).

At the same time, i tried to compile the same code in 32-bit machine and ran the *.exe, in this case it runs through the program and i get "segemntation faults". On debugging, i found that the 3D array (for some reasons) is not assigning values to it.

Thanks in advance
 
Hhhmmm...you sure this is do-able? can you show the math? it is a bit more than 2GB...you have 12 zeroes and a 25 (depending of where you are from that's a billion or a trillion :) ) and that's just if the size of every item in the array is just one byte...if they are floats...

 
Thanks for the reply. I understand it is taking too much of memory certainly > 2GB when i declare the array as static.

Do you think that the use of dynamic memory would solve the problem.

Thanks
 
Phew, that is a hell of a lot of memory that you would use. This is not just > 2GB, this is 25000 GB if it is just one byte, as 64 bit ints or floats this would be 200000 GB = 200 TB (a 32 bit system would not be able to adress this amount of memory). Well, you would need quite a few external harddrives just to save a file this size...

So I'd say this is supercomputer stuff. And the timeframe you would need to do any decent maths on this array would warrant a supercomputer as well. A 4 processor i7 CPU would (at 33 GFLOPS) need a quarter of an hour just to count through the elements of this array.

If you are not working on a supercomputer, you should think of reducing the size of your problem. But how to do this would be vastly depending on the nature of your problem.

But, ehhmmm, if you do not mind my saying so, it would be a typical beginner's problem to set out with vast arrays and load them to memory. Just figure out how many of the 25,000,000,000,000 elements of the array would be zeros...

Norbert




The optimist believes we live in the best of all possible worlds - the pessimist fears this might be true.
 
Thanks for the information. I will try to figure an other of approaching this problem.

 
thanks, gummibaer; I really wanted Naresh20 to actually re-do the math himself and realize how much memory he was asking! Hope he got the point now with all your explanation.

So, Naresh20...I think you need to consider what gummibaer is saying, in particular, the last topic briefly mentioned...the thing about the zeroes...you need to look into techniques for handling sparse matrices and dynamic allocation instead of static...so that you only allocate enough memory to host non-zero entries. You will need a bit more than just the matrix (or vector) itself, you will need a way to keep track of the indeces of the entries (since they will not be at M(i,j) anymore); you may have to use pointers and/or structures, etc. There is a lot of literature about that topic.

 
Hi, Thanks for the time; I am happy to learn by mistakes ;-)...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top