Dear Akshay, All of this seems very confused, and you don't appear to attend to people's attempts to help you: (1) All packages on CRAN are byte-compiled. (2) The NeedsCompilation field in the package DESCRIPTION file refers not to byte-compilation but to the presence of C, C++, or Fortran code in the package, which needs to be compiled in the traditional sense. (3) Oddly, the current version 1.5.1 of the pbmcapply package (not pbmclapply, which is a function in pbmcapply) does include C code and therefore sets NeedsCompilation to true (see <https://cran.r-project.org/web/packages/pbmcapply/index.html>). (4) Most oddly of all, the pbmclapply() function calls the mclappy() function in the parallel package and indeed is described in ?pbmclapply as "a wrapper around the mclapply function." Simply look at the code for pbmclapply(). It is therefore very curious that pbmclapply() is faster than mclapply(), and in the absence of a reproducible example illustrating this phenomenon, I doubt that anyone will be able to tell you why. It might also help to know something about your system, as reported by Sys.info(). (My apologies if you've already reported that.) Best, John
On 2022-07-07 12:48 p.m., akshay kulkarni wrote:
Dear Jeff,
THen why is pbmclapply 3 time faster than mclappy? In the package description of pbmclapply it says: "Needs compilation no". When i ran my code iwith pbmclapply, I did not compile my code. So I do presume that the speed up must in some way connected to this "NeedsCompilation" field. Any thoughts on that?
Yours sincerely
AKSHAY M KULKARNI
________________________________
From: Jeff Newmiller <jdnewmil at dcn.davis.ca.us>
Sent: Thursday, July 7, 2022 10:10 PM
To: r-help at r-project.org <r-help at r-project.org>; akshay kulkarni <akshay_e4 at hotmail.com>; Uwe Ligges <ligges at statistik.tu-dortmund.de>; Bert Gunter <bgunter.4567 at gmail.com>
Cc: R help Mailing list <r-help at r-project.org>
Subject: Re: [R] byte coding compiling.....
That item refers to the package having some compiled language (e.g. C, C++, Fortran, etc) components. The very fact that it got installed confirms that compilation occurred... it would not be usable otherwise.
On July 7, 2022 8:38:49 AM PDT, akshay kulkarni <akshay_e4 at hotmail.com> wrote:
Dear Uwe,
I have attached the info from the parallel package description from my Rstudio IDE:
Package: parallel
Version: 4.1.2
Priority: base
Title: Support for Parallel computation in R
Author: R Core Team
Maintainer: R Core Team <do-use-Contact-address at r-project.org>
Contact: R-help mailing list <r-help at r-project.org>
Description: Support for parallel computation, including by forking
(taken from package multicore), by sockets (taken from package snow)
and random-number generation.
License: Part of R 4.1.2
Imports: tools, compiler
Suggests: methods
Enhances: snow, nws, Rmpi
NeedsCompilation: yes
Built: R 4.1.2; x86_64-w64-mingw32; 2021-11-01 18:38:05 UTC; windows
It says: NeedsCompilation: yes
How about it?
Yours sincerely,
AKSHAY M KULKARNI
________________________________
From: Uwe Ligges <ligges at statistik.tu-dortmund.de>
Sent: Thursday, July 7, 2022 4:08 PM
To: akshay kulkarni <akshay_e4 at hotmail.com>; Bert Gunter <bgunter.4567 at gmail.com>
Cc: R help Mailing list <r-help at r-project.org>
Subject: Re: [R] byte coding compiling.....
On 06.07.2022 19:54, akshay kulkarni wrote:
Dear Bert,
Thanks for your reply...
So
cmpfun(mclapply)
mclapply is already byte compiled as it is in a package.
You may want to
cmpfun(yourFunction)
the function that you use in the mclapply call.
Best,
Uwe Ligges
should do the job right?
By the by, how can I give a reprex? Reprex of the code that I am giving to mclapply (as FUN argument)?
Yours sincerely,
AKSHAY M KULKARNI
________________________________
From: Bert Gunter <bgunter.4567 at gmail.com>
Sent: Wednesday, July 6, 2022 10:32 PM
To: akshay kulkarni <akshay_e4 at hotmail.com>
Cc: R help Mailing list <r-help at r-project.org>
Subject: Re: [R] byte coding compiling.....
Unlikely
See here:
https://www.r-bloggers.com/2017/08/how-to-make-best-use-of-the-byte-compiler-in-r/
Byte code compilation should be automatic in both cases, as I understand it. Of course, I could be wrong due to special features of parallel programming, etc.
A reprex might be helpful here.
Cheers,
Bert
On Wed, Jul 6, 2022, 7:29 PM akshay kulkarni <akshay_e4 at hotmail.com<mailto:akshay_e4 at hotmail.com>> wrote:
Dear members,
I am using pbmclapply, the progress bar version of mclapply, from the parallel package. The point is, pbmclapply is three times faster than mclapply, and I think the most probable reason would be that pbmclapply is byte code compiled (I can think of no other reason).
I know the cmpfun function from compiler package. If I do:
cmpfun(mclapply)
will the job be done? The point is mclapply may look for other functions in the parallel package. So I have to compile the whole package right? How do you do that? or in general, how do you byte code compile a whole package?
Thanking you,
Yours sincerely,
AKSHAY M KULKARNI
[[alternative HTML version deleted]]
______________________________________________
R-help at r-project.org<mailto:R-help at r-project.org> mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Sent from my phone. Please excuse my brevity.
[[alternative HTML version deleted]]
______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
John Fox, Professor Emeritus McMaster University Hamilton, Ontario, Canada web: https://socialsciences.mcmaster.ca/jfox/