Architecting, installing and maintaining your SAS environment

Need A SAS Program to Run for Specific Length of Time

Accepted Solution Solved
Reply
Contributor
Posts: 35
Accepted Solution

Need A SAS Program to Run for Specific Length of Time

[ Edited ]

I'm trying to test RTM and I need to be able to submit a job that will run for say 5 or 10 minutes so I can see how RTM is functioning while a job is running.  Does anyone know of some generic SAS code/program that can be adjusted to run for a specific number of minutes?  The option to stress the CPU and memory of the servers would be a huge plus.

 

Thanks,

 

Dan


Accepted Solutions
Solution
‎11-23-2015 09:12 AM
Super User
Super User
Posts: 7,407

Re: Need A SAS Program to Run for Specific Lenght of Time

Well, there is the sleep() function:

https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001418809.htm

 

Alternatively you could set a series of datasteps upd with do loops for specified number of loops.  However most of base SAS is based on CPU/memory, so changing that will change the run time.  But timing is provided, so you can see that datastep x takes y seconds in this run, and z in that run and see the difference between. 

 

View solution in original post


All Replies
Solution
‎11-23-2015 09:12 AM
Super User
Super User
Posts: 7,407

Re: Need A SAS Program to Run for Specific Lenght of Time

Well, there is the sleep() function:

https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001418809.htm

 

Alternatively you could set a series of datasteps upd with do loops for specified number of loops.  However most of base SAS is based on CPU/memory, so changing that will change the run time.  But timing is provided, so you can see that datastep x takes y seconds in this run, and z in that run and see the difference between. 

 

Contributor
Posts: 35

Re: Need A SAS Program to Run for Specific Lenght of Time

Thanks!
Occasional Contributor
Posts: 14

Re: Need A SAS Program to Run for Specific Length of Time

[ Edited ]

Submit this code.  It will run for a while and rev up the CPU!  Adjust the loop iteration counts to adjust the run time.

 

data _null_;
   do i=1 to 1000000000;
      do j=1 to 1000000000;
          k=i*j;
          l=mod(k,2499900001);
      end;
   end;
run;
Contributor
Posts: 35

Re: Need A SAS Program to Run for Specific Lenght of Time

Excellent! Thank you. This is exactly what I needed.
Contributor
Posts: 35

Re: Need A SAS Program to Run for Specific Lenght of Time

Despite reducing the numbers by several digits, this loop ran for 6+ hours and the CPU never spiked.

Regular Contributor
Posts: 161

Re: Need A SAS Program to Run for Specific Length of Time

While the looping code might accomplish the execution time, it might be worthwhile to note that @RW9's sleep() function might be more code efficient and CPU efficient. 

Kannan Deivasigamani
Valued Guide
Posts: 3,208

Re: Need A SAS Program to Run for Specific Length of Time

You can use
a/ sleep without any load on the system
b/ a cpu loop causing just cpu load
c/ a hash object or buffers with sort causing load on memory change the sizing for load on IO
d/ have a load to an external rdbms so network traffic can get loaded heavily
Tuning load balancing is also on the resource geeting the overload.
---->-- ja karman --<-----
Valued Guide
Posts: 3,208

Re: Need A SAS Program to Run for Specific Length of Time

Of course you will not see a spike in cpu. It is a single threaded process limited to one cpu processor.
You will have to run this at the same time by the number of expected users. It can spread every task on may of those processors. Using a multithreaded proc will show an other load
---->-- ja karman --<-----
SAS Employee
Posts: 2

Re: Need A SAS Program to Run for Specific Length of Time

Data _null_;

Endtime=time()+10*60 /* 10 MIN - change for needed duration */ ;

Do while(time() le Endtime);

/* BESPOKE CODE TO CREATE STRESS */

End;

Run;

 

There will be some cpu overhead in this job due to calling the time function several times.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 9 replies
  • 1869 views
  • 5 likes
  • 6 in conversation