tylermorganwall / rayshader

R Package for 2D and 3D mapping and data visualization
https://www.rayshader.com/
2.06k stars 214 forks source link

render_highquality() not running in parallel #107

Closed tteo closed 3 years ago

tteo commented 4 years ago

Hi Tyler, I seem to have run into a problem with render_highquality(). There is no change in processor load on Windows, sometimes I get a single thread close to 100% but am unable to get all cores to work. Tried setting parallel = TRUE to no avail. On macOS, the R session aborts.

I've tried uninstalling R/RStudio, reinstalling, and compiling rayshader and rayrender from source. Also set my machine to run at stock speeds.

Any ideas?

tylermorganwall commented 4 years ago

Try uninstalling and reinstalling the RcppThread package--it's the driver behind the parallel computation in rayrender.

tylermorganwall commented 4 years ago

Are you still encountering this issue?

tteo commented 4 years ago

Sorry for dropping the ball on this. I tried this, but it didn't work for render_highquality(). It did fix ambient_shade() with multicores = TRUE. This makes me think it might be an issue with my machine, especially if no one else has experienced this.

agilebean commented 4 years ago

Try uninstalling and reinstalling the RcppThread package--it's the driver behind the parallel computation in rayrender.

I think you meant the package Rcpp not RcppThread

tylermorganwall commented 4 years ago

Try uninstalling and reinstalling the RcppThread package--it's the driver behind the parallel computation in rayrender.

I think you meant the package Rcpp not RcppThread

No, RcppThread is correct. It's an extension package that enables multithreaded C++ computation with Rcpp.

agilebean commented 4 years ago

Strange, it wasn't even installed:

remove.packages("RcppThread")
Removing package from ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library’
(as ‘lib’ is unspecified)
Error in remove.packages : there is no package called ‘RcppThread’

Fortunately, installing anew worked:

install.packages("RcppThread")
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/RcppThread_0.5.4.tgz'
Content type 'application/x-gzip' length 310305 bytes (303 KB)

But: plot_gg() throws this error:

ggdiamonds = ggplot(diamonds, aes(x, depth)) +
  stat_density_2d(aes(fill = stat(nlevel)), geom = "polygon", n = 100, bins = 10,contour = TRUE) +
  facet_wrap(clarity~.) +
  scale_fill_viridis_c(option = "A")

plot_gg(ggdiamonds,multicore=TRUE,width=5,height=5,scale=250,windowsize=c(1400,866),
        zoom = 0.55, phi = 30)

Error in makePSOCKcluster(names = spec, ...) : 
  Cluster setup failed. 16 of 16 workers failed to connect.
tylermorganwall commented 3 years ago

@tteo Was this issue fixed when you updated rgl?

tylermorganwall commented 3 years ago

Closing (if the issue isn't resolved, we can reopen the issue, but I don't believe this is a rayshader issue anyway).

tteo commented 3 years ago

Yes, it's all fixed for me now! Thank you!