BookmarkSubscribeRSS Feed
juanvg1972
Pyrite | Level 9

Hi,

 

I am creating threads in a proc ds2 like the above example.

 

My question is:

 

when I execute this in a single node, the threads are executed in differents CPUs

when I execute this in a Hadoop cluster with several nodes, each thread is executed in a different node, 

 

Is this correct????

 

Thanks in advance

 

proc ds2; 
thread tabsas2.my_thread/overwrite=yes;
	dcl int reg ;  /* declaracion vars */
	method init(); /* metodo init solo se ejecuta una vez al inicio */
		put 'inicio';
	end;
	/* metodo definido por el usuario */
	method calculo(int varin) returns int;
		varout = varin*2;
		return varout;
    end;
	method run(); /* metodo run se ejecuta de forma iteratica */
		set test; 
		hc_consumo2=calculo(hc_consumo);
		reg+1;
	end;
	method term(); /* metodo term se ejecuta solo una vez al final */
		put 'fin.' 'hilo:' _threadid_ 'Num reg:' reg;
	end;
endthread;
run; 
quit;

/* Llamada al hilo creado */

proc ds2;
data tabsas2.res_thread/overwrite=yes;
dcl thread tabsas2.my_thread thread_object();

method run();
    set from thread_object threads = 4;
end;
enddata;
run; quit;
1 REPLY 1
ChrisNZ
Tourmaline | Level 20

I read a bit about this topic out of interest, but never actually had a chance to try myself, so take my reply with a HUGE pinch of salt.

 

1. when I execute this in a single node, the threads are executed in different CPUs

The OS decides where the threads go, but this is the best approximation of the typical behaviour

 

2. when I execute this in a Hadoop cluster with several nodes, each thread is executed in a different node, 

As I understand it, the only ways you could have multiple threads in Hadoop is if either:

1- proc ds2 sends several queries to the database (option sastrace = ',,,d' doesn't seem to monitor this connection), somehow telling it to only process a non-overlapping subset of the data in each query.

2- You have in-database licensed and installed

 

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
  • 873 views
  • 1 like
  • 2 in conversation