BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
AmitKB
Fluorite | Level 6

Hi all,

            I was able to run form a 5000 nodes matrix in around 2 hours. But when i run for a 8000 nodes matrix it just ends in a second with no error. Is it memory issue or something else.

           Appreciate you help.

Amit

Code:

proc fcmp;

array A[8000,8000] / nosymbols;

array Ident[8000,8000] / nosymbols;

array Z[8000,8000] / nosymbols;

  array P[8000,8000] / nosymbols;

    do i = 1 to 8000;

      do j = 1 to 8000;

         A[i, j] = RANUNI(12345);

  if A[i, j] le .4 then A[i, j] = 0;

  else A[i, j] = 1;

         A[i, j] =  0.5*A[i, j];

  Ident[i,j] = A[i,j];

  

   end;

     end;

call IDENTITY (Ident);

CALL SUBTRACTMATRIX (Ident, A, Z);

CALL INV (Z, P);

rc = write_array('result', p);

run;

log:

NOTE: PROCEDURE FCMP used (Total process time):

      real time           0.24 seconds

      cpu time            0.01 seconds

1 ACCEPTED SOLUTION

Accepted Solutions
ArtC
Rhodochrosite | Level 12

The matrix being inverted seems a bit large, and memory may indeed be an issue.  Have you tried increasing the memory buffers?

Although it won't help with the memory, we can speed up the processing a bit by replacing your A[I,J] IF-THEN/ELSE assignment statements.

  r=ranuni(12345);

  a[i,j] = 0*(r<=.4)+.5*(r>.4);

View solution in original post

3 REPLIES 3
ArtC
Rhodochrosite | Level 12

The matrix being inverted seems a bit large, and memory may indeed be an issue.  Have you tried increasing the memory buffers?

Although it won't help with the memory, we can speed up the processing a bit by replacing your A[I,J] IF-THEN/ELSE assignment statements.

  r=ranuni(12345);

  a[i,j] = 0*(r<=.4)+.5*(r>.4);

AmitKB
Fluorite | Level 6

Hi Art,

             Appreciate your help. I have previously taken you class on Macro programming. It was really helpful. Thank you for being a great teacher.

              It is memory issue. How can i increase the memory buffer as you mentioned? How does one find how much the memory buffer is?

            Also I have updated my code to remove the if then else.

Regards,

Amit

ArtC
Rhodochrosite | Level 12

An earlier thread on memory usage and matricies can be found at: https://communities.sas.com/message/140513#140513

The system option for memory allocation is MEMSIZE.  You may also get more detailed responses in the SAS/IML forum, which specializes in issues with matrix manipulation.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 920 views
  • 0 likes
  • 2 in conversation