Since the context is missing in this message, from others this is about 32-bit Windows.

On Thu, 15 Apr 2010, yehengxin wrote:

Thanks for your response.  I found the folder to modify the compiler for C
source codes.  C++ 6.0 is an old C programming environment (1994~1998) but
it is efficient.   When compiling C source codes in C programming
environment, one needs to choose between "debug" or "release" modes.

That's true for just one family of compilers in my experience.

"release" mode is much faster than "debug" mode.  But in R's "R CMD SHLIB",
I did not see such an option.

Then I suspect you did not look in the obvioud place (mentioned on the help page), for I see

% R CMD SHLIB --help
...
Windows only:
  -d, --debug           build a debug DLL

An optimized ('release') build is standard, and in any case gcc is capable of both optimizing and including debug information, unlike some other compilers. With gcc debug code is normally the same speed, just a larger compiled file.

I want to try alternative compilers to see if I can reach that level of
efficiency in R's DLL.

This is *your* DLL, not one in R, surely? Note that people have compiled R with Visual C++ 6.0 (to use the correct name) and it ran slower and less accurately than using gcc. So finding VC++ to produce faster code is not usual, and this seems to be something special about your C code. The default level of optimization for gcc in R for Windows is -O3, and you could try raising it: also if you want to target only recent non-Atom chips set -tune= appropriately.

x86 is a very widely used architecture with a competitive field of commercial compilers. On Linux (and AFAIK on Windows) gcc produces some of the best-performing code (see the comments in the 'R Administration and Installation Manual'). Most of the ways to produce faster code lose compliance with IEC60559 and accuracy (VC++ 6 never has those). And the same code compiled with gcc runs on the same hardware only slightly slower on Windows than on Linux unless I/O is involved (where Windows is much slower).

Later, I may try using "OPENMP" in my C codes to do parallel computing.

gcc 4.2.1 supports OpenMP, and later versions support it better (OpenMP 3).

So I need to figure out how to change compiler to
generate DLL for R.  Could you give me some suggestions?  Thanks a lot!

A DLL is a DLL: you can compile it any way you like (although cdecl calling conventions work best, and compilers do differ in their conventions for function return values -- but those are not used in the .C interface). There is a file README.packages in the R distribution with notes about using other compilers under Windows -- but the R developers have not used other than VC++ and Intel's ICC (not mentioned there) for several years.

--
Brian D. Ripley,                  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to