Error when produce a large file

Hello

I’m using root to produre a large file which is about 6G, but the generated file is about 1.8G and also the content is wrong.

At first, I doubt the linux system has some limitations in produre a file larger than 2G. Then I write a simple c program to produce a large file about 6G and it works. I thought if there is some limitations in root to produre a large file or if I need to do some special changes.

In addition, my command to execute function is “root -l xxx.c” and I am sure my xxx.c file is correct.

Many Thanks
Vera

Can you post a small macro reproducing the problem ?

Sure.

I add my Test.c file as the following:
Test.c (753 Bytes)

And thanks for your reply~

The Clinic*.root files are missing.

This is a sample example for explanation.
No matter what the content is and the file is excepted to be 57528896964/1024/1024≈6G. But the generated file is about 1.8G. And this is my problem.

Many thanks for your reply~

Or your could execute the following file:Test.c (621 Bytes)

Hi Vera,

this last file is basically pure C++ but the instantiation of a TChain. In other words ROOT does not seem to be the issue but rather the underlying system.
I just tried to run it as a macro on macos and the file is produced just fine. Are you sure that for example you are not on a 32-bits platform?

Cheers,
D

Yes, I am very sure my platform is 64-bits.

I wrote a C file as follows. Compiled and executed it, and the produced file is about 6G.

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(int argc,char *argv[])
{
 FILE *fp;

 int numLOR=575*288*96*96;
 float *michelogram=0;
 michelogram=(float *)malloc(numLOR*sizeof(float));
 memset(michelogram, 0, numLOR*sizeof(float));
 
 for(int i=0;i<numLOR;i++)
 {
    michelogram[i]=1; 
 }

 fp=fopen("Test_1.dat", "wb");
 fwrite(michelogram, sizeof(float), numLOR, fp);
 fclose(fp);
 
 printf("finished!");

 return 0;
}

May I ask which version is your root ? My root version is 5.34 and system is Ubuntu 14.04. Is it possible to be associated with the version?

Thanks for your reply~

Vera

Hi,

I am on ROOT 6.10/04 .

D

Using ROOT 6 is always a good idea. I bet it will immediately fix this issues.

When you rename the main function you wrote (say in nochain()), and you run this in ROOT (.x nochain.C), do you also get a 1.8GB file?

I bet CINT (the ROOT 5 interpreter) is limiting the size to int:

root [0] (575*288*96*96*sizeof(float))
(unsigned long) 6104678400 
root [1] (int)(575*288*96*96*sizeof(float))
(int) 1809711104

something that ROOT 6 would never do, thanks to its new interpreter.

Cheers, Axel.

I have to say you are right.

After I update the root version, the produced file could up to 6G.
I solved this problem and then I have serval other compatibility issues to solve.

Many thanks~
Vera

1 Like

It is the version problem.

Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.