- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Sir/Madam,
I am a student from University of Connecticut. I am now using "SGI Altix 3700 BX2 system". The system contains 64 Intel Itanium 2 processors and 64 GB memory. I do C program on it. Now I met some problem on my project(The program can run in personal computer correctly). The problem is memory allocation and it seems caused by memory alignment.
Now I copy part of my program to you (the error part). I do not know I can explain what happened, let me try.
I use this subroutine to allocate a 3D matrix space for my algorithm. While it runs to the line marked by /*error*/, it can run through until i=0, j=20. Then the error information shows up:
"Program received signal SIGSEGV, Segmentation fault.
0x20000000001d00c1 in _int_malloc () from /lib/tls/libc.so.6.1"
The program is:
/**********************************************************************************************/
double ***AllocMatrix1(short nxl,short nxh, short nyl,short nyh, short nzl,short nzh)
{
short i,j,k;
double *** m;
m=(double ***) malloc((unsigned) ((nxh-nxl)+1)*sizeof(double**));
if (!m) nrerror("allocation failure 1 in matrix()");
m -= nxl;
for(i=nxl;i<=nxh;i++) {
m=(double **) malloc((unsigned) ((nyh-nyl)+1)*sizeof(double*));
if (!m) nrerror("allocation failure 2 in matrix()");
m -= nyl;
for(j=nyl;j<=nyh;j++) {
/**The problem happened in this loop while j=20, (now i=0),
in this program the maxmum number is nzh=700***/
/*error*/ m=(double *) malloc((unsigned) (nzh-nzl+1)*sizeof(double));
if (!m) nrerror("allocation failure 3 in matrix()");
m -= nzl;
}
}
for(i=nxl;i<=nxh;i++)
for(j=nyl;j<=nyh;j++)
for(k=nzl;k<=nzh;k++) m = 0.0;
return m;
}
Thank you very much for your help!
Best regards,
Rae
I am a student from University of Connecticut. I am now using "SGI Altix 3700 BX2 system". The system contains 64 Intel Itanium 2 processors and 64 GB memory. I do C program on it. Now I met some problem on my project(The program can run in personal computer correctly). The problem is memory allocation and it seems caused by memory alignment.
Now I copy part of my program to you (the error part). I do not know I can explain what happened, let me try.
I use this subroutine to allocate a 3D matrix space for my algorithm. While it runs to the line marked by /*error*/, it can run through until i=0, j=20. Then the error information shows up:
"Program received signal SIGSEGV, Segmentation fault.
0x20000000001d00c1 in _int_malloc () from /lib/tls/libc.so.6.1"
The program is:
/**********************************************************************************************/
double ***AllocMatrix1(short nxl,short nxh, short nyl,short nyh, short nzl,short nzh)
{
short i,j,k;
double *** m;
m=(double ***) malloc((unsigned) ((nxh-nxl)+1)*sizeof(double**));
if (!m) nrerror("allocation failure 1 in matrix()");
m -= nxl;
for(i=nxl;i<=nxh;i++) {
m=(double **) malloc((unsigned) ((nyh-nyl)+1)*sizeof(double*));
if (!m) nrerror("allocation failure 2 in matrix()");
m -= nyl;
for(j=nyl;j<=nyh;j++) {
/**The problem happened in this loop while j=20, (now i=0),
in this program the maxmum number is nzh=700***/
/*error*/ m
if (!m
m
}
}
for(i=nxl;i<=nxh;i++)
for(j=nyl;j<=nyh;j++)
for(k=nzl;k<=nzh;k++) m
return m;
}
Thank you very much for your help!
Best regards,
Rae
Link Copied
0 Replies

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