multicore in windows

9 views
Skip to first unread message

Moran Koren

unread,
Apr 25, 2013, 7:14:58 AM4/25/13
to israel-r-...@googlegroups.com
Hi All,
Does anyone know if how can we set the number of cores in use in windows?
(similar to the linux options("mc.core")<-4)

thanks

--

Jonathan Rosenblatt

unread,
Apr 26, 2013, 5:00:30 AM4/26/13
to israel-r-...@googlegroups.com
אנא סלח לי על הבורות-
זו שאלת 
R?

--
You received this message because you are subscribed to the Google Groups "Israel R User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-g...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Jonathan Rosenblatt
www.john-ros.com

Moran Koren

unread,
Apr 26, 2013, 9:36:26 AM4/26/13
to israel-r-...@googlegroups.com

כמובן!!! החל מגירסא 2.15.3 החבילה שמאפשרת שימוש במספר מעבדים נכנסה לחבילת הבסיס....אבל זה עובד בעיקר בלינוקס

Jonathan Rosenblatt

unread,
Apr 26, 2013, 4:25:37 PM4/26/13
to israel-r-...@googlegroups.com
I admit I do not see why this would be platform specific.
In 2.14.0 the parallel package was first supplied with the base distribution.
Assuming you are using this package, you are probably starting the multiple cores with makeCluster(), which defaults to calling makeForkCluster(), which does indeed query the local variables using nnodes=getOption("mc.cores", 2L).

This suggests that you can control the number of slaves by calling, say,  makeCluster(nnodes=6, ...), if you want 6 slaves.

Does this work?

Jonathan

Moran Koren

unread,
Apr 26, 2013, 4:34:39 PM4/26/13
to israel-r-...@googlegroups.com
Actually I've only got around to use mclapply(), which only work with 1 core on windows, very sad....

how do I use makeCluster?

Tal Galili

unread,
Apr 26, 2013, 5:12:12 PM4/26/13
to israel-r-...@googlegroups.com
הנושא של חישוב מקבילי ב-R הוא מאד תלוי מערכת (לצערי).
בזמנו מצאתי פתרון עבור Windows:
אבל פעם אחרונה שהסתכלתי על זה שוב (אני חושב לפני חצי שנה בערך), זה כבר לא עבד יותר היות ו REvolution הסירו את החבילה:
יש את החבילה הבאה שכנראה משיגה תוצאות דומות:
ויש כמה דוגמאות ברשת לשימוש בה, לדוגמא:
אבל לא היה לי הזדמנות לעבור ולראות מהן הפתרונות העדכניים.

אוקצ, אם מישהו פה התנסה בחישוב מקבילי ב- R עבור חלונות, אני אשמח לראות קוד לדוגמא :)

טל



----------------Contact Details:-------------------------------------------------------
Contact me: Tal.G...@gmail.com
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English)
----------------------------------------------------------------------------------------------

david golan

unread,
Apr 27, 2013, 9:35:58 AM4/27/13
to israel-r-...@googlegroups.com
אני בזמנו השתמשתי בdoSNOW. קצת לא נוח להרים את הסט-אפ בפעם הראשונה, אבל ברגע שזה רץ תכלס זה יכול לחסוך הרבה זמן. בטח היום יש דרכים יותר נוחות לעשות את זה. 

זה נראה בערך ככה:

#################################
# Utils for multicore processing
#################################
require(snow) 
require(doSNOW) 
require(foreach) 

cl.tmp = makeCluster(rep("localhost",3), type="SOCK") 
registerDoSNOW(cl.tmp) 
##################################

f <- function(x){
Sys.sleep(5)
return(x^2)
}


ret <- foreach(i=1:3) %dopar% f(i)

Reply all
Reply to author
Forward
0 new messages