Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lessons #42

Open
HughParsonage opened this issue May 14, 2020 · 0 comments
Open

Lessons #42

HughParsonage opened this issue May 14, 2020 · 0 comments
Assignees

Comments

@HughParsonage
Copy link
Contributor

HughParsonage commented May 14, 2020

Some random lessons working with Rcpp

  • stacks are dangerously seductive, std::array was apparently safer but still quite tricky
  • even relative recent (i.e. 2010-2018) rules-of-thumb for compilers have been blown out of the water by Spectre bugs et al. Speculative execution is much harder, if statements are costly even if predictable. Sometimes you do have to optimize not just 'write C++'
  • But you can get far by just writing C++
  • Using OpenMP makes the code much faster, but not necessarily on other computers, and maybe not much faster than just distributing it over an embarrrassingly large number of cores.
  • My computer is inexplicably fast
  • R -d ldb is R -d gdb is incredible for hunting segfaults. Tutorials: https://blog.davisvaughan.com/2019/04/05/debug-r-package-with-cpp/ and http://kevinushey.github.io/blog/2015/04/13/debugging-with-lldb/ made finding bugs fun
  • Dirk says I can't write omp threaded code using IntegerVector and friends. He's almost certainly right but (a) I've been doing it for a while and never had problems and (b) when I've done something else wrong the segfault manifested itself within the day at the latest.
  • Don't (inadvertently) try to solve the Byzantine Generals problem
@HughParsonage HughParsonage self-assigned this May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant