Skip to content

Conversation

@coatless
Copy link
Contributor

This adds an inline plugin for the R extension.

Close #3613

/cc & h/t @cgiachalis

@eddelbuettel
Copy link
Contributor

Zongs! I thought we long had one? That absolutely belongs!

Copy link
Contributor

@eddelbuettel eddelbuettel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I may make one change.

Copy link
Member

@rcurtin rcurtin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me (but, of course, my R knowledge is very limited); do you want to add a change to HISTORY.md too? 👍

Rcpp::Rcpp.plugin.maker(
include.before = "#include <mlpack.h>",
libs = paste(openmp_flag, "$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)"),
LinkingTo = c("RcppArmadillo", "Rcpp", "RcppEnsmallen", "mlpack"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does RcppEnsmallen have any shared objects to link against? ensmallen is header only, so at least in C++-land there's nothing to link against. Anyway, I certainly don't know Rcpp plugins, so maybe this is needed just to indicate the dependency, I dunno. 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LinkingTo justs points to the header`s location. So we need it.

Copy link
Contributor

@eddelbuettel eddelbuettel Feb 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rcurtin It's all R's funky language. LinkingTo does not link because heck why would you think it does? 😜

RcppArmadillo has been header-only for R forever and ever. Armadillo usually needs linking to get LAPACK and BLAS but when loaded from R we already have that. RcppEnsmallen (and many others) do the same, and the big big actually Yuge achievement of MLPACK 4 was to get to the same point. Header-only compiles from R.

I think I blogged a little about it when it happened and thought I had added such a helper. Clearly not. This will be good have (on CRAN in the next release) and we then spin some more wheels for awareness.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much appreciate the explanation, thank you both! 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eddelbuettel speaking of awareness , here the demo package (template) I had created as part of #3613. Of course it works only if there is a plug-in helper but someone can follow the instructions in the issue if they can't wait for the CRAN release.

@coatless coatless changed the title Add an inline plugin for R [R] Add an inline plugin for R Feb 22, 2024
@coatless
Copy link
Contributor Author

@rcurtin added a note inside of HISTORY.md and incorporated the R version check for CXX14 support suggested by @eddelbuettel.

Copy link
Member

@rcurtin rcurtin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, whenever you're happy with it, I say merge away! 🚀

@coatless
Copy link
Contributor Author

Okidokie, merging in. Thanks for the fast review @eddelbuettel + @rcurtin.

Also, thanks goes out to @cgiachalis for bringing it to our attention. Sorry it took 3 weeks(!) to get it rectified. If you notice anything else amiss, please create an issue and tag either myself (@coatless) or @eddelbuettel so we can work on the problem.

@coatless coatless merged commit 757d780 into mlpack:master Feb 23, 2024
This was referenced May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[R binding] - Should the R pkg supply an inline plugin helper?

4 participants