Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.
Close
From: SourceForge.net <noreply@so...>  20050907 00:19:49

Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=3327752 By: fulfordg Hi, I am a beginner at C programming and I was trying to write a lab for a couse I am teaching in scientific computing. I wanted the lab to find the amount of time for an NxN matrix to be sqared, and invetigate the time as the matrix size N is increased (hopfully seeing a quadratic increase in time until the L1 cache fills up). In my program, below, the program compiles ok but crashes when I try to run it with a matrix of size greater than about 360 x 360, of double precision numbers. I am using the mingw that comes with the latest devcpp ide. I have search the web, and I think my problem has to do with the fact that I create the matrix size statically rather than dynammcally  it tries to store the matrix on the stack rather than the heap, what ever this means? A friend showed me how to create the matrix do it dynamically using malloc, which worksd fine, at least upto size 1000, but I don't really want to do this for my students yet. So my question is, is it possble to enlage the stack size, and how do i do this? (My friend expressed some surprise that my program did crash on windows with such a small matrix, and I tried running it on our sgi supercomputer and it ran fine there with matirices of sixe 1000 x 1000.) Thanks foir any help you can give me. Glenn ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=286529 
From: SourceForge.net <noreply@so...>  20050907 00:20:33

Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=3327754 By: fulfordg Hi, I am a beginner at C programming and I was trying to write a lab for a couse I am teaching in scientific computing. I wanted the lab to find the amount of time for an NxN matrix to be sqared, and invetigate the time as the matrix size N is increased (hopfully seeing a quadratic increase in time until the L1 cache fills up). In my program, below, the program compiles ok but crashes when I try to run it with a matrix of size greater than about 360 x 360, of double precision numbers. I am using the mingw that comes with the latest devcpp ide. I have search the web, and I think my problem has to do with the fact that I create the matrix size statically rather than dynammcally  it tries to store the matrix on the stack rather than the heap, what ever this means? A friend showed me how to create the matrix do it dynamically using malloc, which worksd fine, at least upto size 1000, but I don't really want to do this for my students yet. So my question is, is it possble to enlage the stack size, and how do i do this? (My friend expressed some surprise that my program did crash on windows with such a small matrix, and I tried running it on our sgi supercomputer and it ran fine there with matirices of sixe 1000 x 1000.) Thanks foir any help you can give me. Glenn #include <stdlib.h> #include <stdio.h> #define N 450 int main(void){ double A[N][N]={{1.0}}; double C[N][N]={{0}}; int i,j,k; printf("A(0,0)=%f\n", A[0][0]); for (i=0; i<=N1; i++){ for (j=0; j<=N1; j++){ for (k=0; k<=N1; k++){ C[i][j] = C[i][j] + A[i][k]*A[k][j]; } } } printf("C first element=%f\n", C[0][0]); system("pause"); return 0; } /* end main */ ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=286529 