- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I need _mm_malloc() to allocate large arrays (>2Gb). However, I seem to have problems. I have attached a simple program in which I declare a size_t array dimension of 4E9 elements. I can malloc() without problem, but _mm_malloc() segfaults on execution. Here is the program:
Thanks in advance,
Morgan Brown
I need _mm_malloc() to allocate large arrays (>2Gb). However, I seem to have problems. I have attached a simple program in which I declare a size_t array dimension of 4E9 elements. I can malloc() without problem, but _mm_malloc() segfaults on execution. Here is the program:
int main(int argn, char** args) {Interestingly, the compiler warns me when I try to _mm_malloc(). It seems that my size_t is being truncated to 32-bit int(???).
float *a;
size_t k = 4000000000;
long long i;
a = malloc(k);
for( i=0; i= 1.0*i; }
free(a);
a = (void *) _mm_malloc( k, 16 );
for( i=0; i= 1.0*i; }
_mm_free(a);
exit(0);
}
remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)Environment:
a = (void *) _mm_malloc( k, 16 );
^
- Machine: 64-bit Opteron, 8Gb memory
- Compiler: icc 9.0
Thanks in advance,
Morgan Brown
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you are running the 64-bit compiler, you needn't be using _mm_malloc(). glibc malloc() will give 16-byte alignment by default (at least when used with correct headers and paths). _mm_malloc() has always posed portability problems; I don't know why they aren't addressed, at least for Intel compilers. You could post an issue on premier.intel.com, after correcting your sample, if you think an improvement would help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, Tim. That's all I needed to know to recommend ditching _mm_malloc().
Morgan
Morgan
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page