When I run an auto.arima code with the Parallel = TRUE turned on. i am getting the following error.
Error in mclapply(X = to.check, FUN = par.all.arima, max.order = max.order, :
'mc.cores' > 1 is not supported on Windows
My code that I have used for the last 2 years on my old computer looks like this, and it fails when it gets to the auto.arima portion.
for (i in levels(SalesForecast$`Bill To Name`)) {
Forecast<-SalesForecast%>%filter(`Bill To Name` == i)%>%droplevels()
for (k in levels(SalesForecast$`Product Code`)) {
Forecast2<-Forecast%>%filter(`Product Code` == k)%>%droplevels()
print(i)
print(k)
print(Sys.time())
if (nrow(Forecast2) < 15) next
if (i == "Blount" & grepl("*ALLNAT" , k)) next
Forecast3<-CalendarForecast%>%left_join(Forecast2, by = "ShipOn Date")%>%
mutate(Weekday = weekdays(as.Date(`ShipOn Date`)))
Forecast3$Wgt[is.na(Forecast3$Wgt)]<- 0
Forecast3$Weekday<-as.numeric( factor(Forecast3$Weekday, order = TRUE,
levels = c("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")))
#Create Time Series
ForecastTS<-ts(Forecast3[,4], start = c(2021,01,01), frequency = 365.25)
#Create XRegression
Forecastxreg<- cbind(Weekday=model.matrix(~as.factor(Forecast3$Weekday)))
# Remove intercept
Forecastxreg<-Forecastxreg[,-1]
# Rename columns
colnames(Forecastxreg)<- c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
####################
#Auto.ARIMA Model
####################
fit_arima_Sales<-auto.arima(
ForecastTS,d=1,D=1, xreg = Forecastxreg, stepwise = FALSE, approximation = FALSE, parallel = TRUE, num.cores = 15)
#Forecast the future
ForecastSalesKPP<-forecast(fit_arima_Sales, xreg = xregnew)
ForecastSalesKPP<-as.data.frame(ForecastSalesKPP)
KPPSalesForecast<-cbind(CalendarNewData,ForecastSalesKPP)
colnames(KPPSalesForecast) <- c("ShipOn Date", "Forecast", "Low 80", "High 80", "Low 90", "High 90")
KPPSalesForecast$`ShipOn Date`<-as.Date(KPPSalesForecast$`ShipOn Date`)
KPPSalesForecast[c("Forecast")][(KPPSalesForecast[c("Forecast")]) < 0]<- 0
KPPSalesForecast<-KPPSalesForecast%>%mutate(`Bill To Name` = i , `Product Code` = k)%>%select(1,7,8,2)
ForecastOutput<-rbind(ForecastOutput, KPPSalesForecast)
}
}
i have tried to used an older version R and Rstudio that match my old computer. it will run without the error BUT it still only uses the 1 Core.
How do I get it to use the multi core again.
Old PC was Windows 10 w/ i9 8 core and 16 logical processors
New PC is a windows 10 w/ i9 8 core and 24 Logical processors
if i run the detectcores() function it shows that there are 24 .