Community
cancel
Showing results for 
Search instead for 
Did you mean: 
rfrazinumich_edu
Beginner
68 Views

fread problem -- not fully 64-bit compliant?

When use icpc, fread only properly reads files less than about 2.05 GB in length. Below that limit, it correctly places the elements into the array, but above that, it fills the array with zeros. Was fread updated to be 64-bit compliant? It seems not. I have the same problem when I compile with gcc-4.2 as well. See below for the icpc version

sh-3.2$ icpc -V
Intel C++ Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20090827 Package ID: m_cproc_p_11.1.067
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
30 DAY EVALUATION LICENSE
0 Kudos
4 Replies
TimP
Black Belt
68 Views

When use icpc, fread only properly reads files less than about 2.05 GB in length. Below that limit, it correctly places the elements into the array, but above that, it fills the array with zeros. Was fread updated to be 64-bit compliant? It seems not. I have the same problem when I compile with gcc-4.2 as well.
Yes, this would be a glibc function, so icpc and g++ would see the same library. Experts on that may not be reading this list, but the exact glibc version is likely to be needed, e.g.
rpm -qa glibc
If a problem report is made against icc on premier.intel.com, preferably with a simple test case, it should go to a glibc expert.
As you haven't shown an example, I would note that fread works with size_t data types, but 32-bit legacy programmers would probably use int, and that would account for such a problem.
JenniferJ
Moderator
68 Views

use -mcmodel=medium or -mcmodel-large to change the memory model.
default is -mcmodel=msmall.

Jennifer
TimP
Black Belt
68 Views

.............................
TimP
Black Belt
68 Views

I guess Jennifer's point would be that you couldn't make a static array bigger than that without setting the memory model. A malloc or new array ought to be OK with default memory model.
Reply