- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I want to read a binary file. I create the file by using Matlab and then I read by Fortran.
For this example, I used the command:
ifort -qopenmp -I$/openmp/intel/oneapi/mkl/2022.1.0/include/intel64/ilb64-m64 -DMKL_ILP64 -i8 -I"$/opt/intel/oneapi/mkl/2022.1.0/include" -fpp -qmkl -nologo -O3 -Os -parallel -heap-arrays[0] Console1.f90 -o Console1
I can run the program well by visual studio. If I use ifort compiler, for small N (N=3) I can read the binary file but for the large N (N=900) I can not read. The error is:
forrtl: severe (24): end-of-file during read, unit 1, file /home/hieu/Downloads/testbin/A.bin
Image PC Routine Line Source
Console1 0000000000440A49 Unknown Unknown Unknown
Console1 00000000004150FC Unknown Unknown Unknown
Console1 000000000041258E Unknown Unknown Unknown
Console1 0000000000404F27 Unknown Unknown Unknown
Console1 0000000000404D62 Unknown Unknown Unknown
libc-2.17.so 00007F9CD0DFE555 __libc_start_main Unknown Unknown
Console1 0000000000404C69 Unknown Unknown Unknown
Is there any option of ifort command I am missing or any mistake I made?
I attach the binary file and the Fortran code. Please help me!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The .bin file contains N X N four-byte integers (4 N X N = 3240000 bytes). In contradiction to this assumption, you specify the -i8 compiler option, which tells the compiler that eight-byte integers are to be used.
You are mistaken in your conclusion that for small N the program runs well. You may not see any error messages during such a run, but the values read will definitely be wrong, as you can verify by printing out a few values.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The .bin file contains N X N four-byte integers (4 N X N = 3240000 bytes). In contradiction to this assumption, you specify the -i8 compiler option, which tells the compiler that eight-byte integers are to be used.
You are mistaken in your conclusion that for small N the program runs well. You may not see any error messages during such a run, but the values read will definitely be wrong, as you can verify by printing out a few values.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much!
By changing -i8 to -i4 I can run my program.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for accepting our solution. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.
Best Regards,
Shanmukh.SS
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page