BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
whymath
Lapis Lazuli | Level 10

I am learning to write PROC DS2, some materials says there is a threads= option, which enables SAS use multiple threads to run program, so SAS can run faster. I write the following program:

data test1;
  set sashelp.class;
  do i=1 to 3e6;
    output;
  end;
run;

*Normal data step;
data test2;
  set test1;
  sum_age+age;
run;

proc delete data=test2;
run;

*Data step in DS2, without multiple threads;
proc ds2;
  data test3/overwrite=yes;
    method run();
      dcl int sum_age;
      set test1;
      sum_age+age;
    end;
  enddata;
  run;
quit;

proc delete data=test3;
run;

*Data step in DS2, with multiple threads;
proc ds2;
  thread t/overwrite=yes;
    method run();
    dcl int sum_age;
    set test1;
    sum_age+age;
    end;
  endthread;
  run;

  data test4/overwrite=yes;
    dcl thread t t_instance;
    method run();
      set from t_instance threads=8;
    end;
  enddata;
  run;
quit;

Well, I just can't understand the running time:

Normal data step
real time: 2.97 seconds
cpu time: 2.87 seconds

Data step in DS2, without multiple threads
real time: 6.83 seconds
cpu time: 8.06 seconds

Data step in DS2, with multiple threads
real time: 4.47 seconds
cpu time: 13.26 seconds

And I write proc delete before taking each test, to keep the WORK library clean. My questions are:

1. Why data step in ds2 without multiple threads costs much time than normal data step?

2. Why data step in ds2 with multiple threads  costs much time than normal data step? Even I let threads=16, there is not significant difference on real time.

1 ACCEPTED SOLUTION

Accepted Solutions
AhmedAl_Attar
Rhodochrosite | Level 12

Hi @whymath 

 

Check out this paper "User-Defined Multithreading with the SAS® DS2 Procedure: Performance Testing DS2 Against Functionall..."

by Troy Martin Hughes 

He does an excellent job in explaining what you are observing.

 

Hope this helps,

Ahmed

View solution in original post

1 REPLY 1
AhmedAl_Attar
Rhodochrosite | Level 12

Hi @whymath 

 

Check out this paper "User-Defined Multithreading with the SAS® DS2 Procedure: Performance Testing DS2 Against Functionall..."

by Troy Martin Hughes 

He does an excellent job in explaining what you are observing.

 

Hope this helps,

Ahmed

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 387 views
  • 2 likes
  • 2 in conversation