[Rd] Rprof(..., memory.profiling=TRUE) to profile C memory allocation?

2014-11-22 Thread Henrik Bengtsson
Could someone please confirm/refute that Rprof(...,
memory.profiling=TRUE) can also be used to profile memory allocation
done in a C function (src/*.c) that uses, e.g.

  allocVector(INTSXP, n)

but also allocations such as

 R_alloc(n, sizeof(int))

?

Modulo how R was built, does the answer depend on OS?  I'm interested
in all the major ones (Linux, OS X and Windows).

Thanks,

Henrik

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] R string comparisons may vary with platform (plain text)

2014-11-22 Thread Henrik Bengtsson
On Sat, Nov 22, 2014 at 12:42 PM, Duncan Murdoch
 wrote:
> On 22/11/2014, 2:59 PM, Stuart Ambler wrote:
>> A colleague¹s R program behaved differently when I ran it, and we thought
>> we traced it probably to different results from string comparisons as
>> below, with different R versions.  However the platforms also differed.  A
>> friend ran it on a few machines and found that the comparison behavior
>> didn¹t correlate with R version, but rather with platform.
>>
>> I wonder if you¹ve seen this.  If it¹s not some setting I¹m unaware of,
>> maybe someone should look into it.  Sorry I haven¹t taken the time to read
>> the source code myself.
>
> Looks like a collation order issue.  See ?Comparison.

With the oddity that both platforms use what look like similar locales:

LC_COLLATE=en_US.UTF-8
LC_COLLATE=en_US.utf8

/Henrik

>
> Duncan Murdoch
>
>> Thanks,
>> Stuart
>>
>> R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
>> Platform: x86_64-unknown-linux-gnu (64-bit)
>> Sys.getlocale()
>> [1]
>> "LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF
>> -8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_
>> NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICA
>> TION=C"
>>
>> "-1" > "1"
>> [1] TRUE
>>
>> "-1" <"1"
>> [1] FALSE
>>
>> "1" < "-1"
>> [1] TRUE
>>
>> "1" < "-"
>> [1] FALSE
>>
>> Vs.
>>
>> R version 3.1.1 (2014-07-10) ‹ ³Sock it to Me"
>> Platform: x86_64-redhat-linux-gnu (64-bit)
>> Sys.getlocale()
>> [1]
>> "LC_CTYPE=en_US.utf8;LC_NUMERIC=C;LC_TIME=en_US.utf8;LC_COLLATE=en_US.utf8
>> ;LC_MONETARY=en_US.utf8;LC_MESSAGES=en_US.utf8;LC_PAPER=en_US.utf8;LC_NAME
>> =C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.utf8;LC_IDENTIFICATION
>> =C"
>>
>> "-1" > "1"
>> [1] FALSE
>>
>> "-1" <"1"
>> [1] TRUE
>>
>> "1" < "-1"
>> [1] FALSE
>>
>> "1" < "-"
>> [1] FALSE
>>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] R string comparisons may vary with platform (plain text)

2014-11-22 Thread Stuart Ambler
You mean where it says that some platforms may not respect the locale (I
assume, though don’t know, that en_US.UTF-8 and en_US.utf8 would be the
same)?  But I gather that the general problem has been looked into and is
difficult to solve; thanks.

On 11/22/14, 12:42 PM, "Duncan Murdoch"  wrote:

>On 22/11/2014, 2:59 PM, Stuart Ambler wrote:
>> A colleague¹s R program behaved differently when I ran it, and we
>>thought
>> we traced it probably to different results from string comparisons as
>> below, with different R versions.  However the platforms also differed.
>> A
>> friend ran it on a few machines and found that the comparison behavior
>> didn¹t correlate with R version, but rather with platform.
>> 
>> I wonder if you¹ve seen this.  If it¹s not some setting I¹m unaware of,
>> maybe someone should look into it.  Sorry I haven¹t taken the time to
>>read
>> the source code myself.
>
>Looks like a collation order issue.  See ?Comparison.
>
>Duncan Murdoch
>
>> Thanks,
>> Stuart
>> 
>> R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
>> Platform: x86_64-unknown-linux-gnu (64-bit)
>> Sys.getlocale()
>> [1] 
>> 
>>"LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.U
>>TF
>> 
>>-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;L
>>C_
>> 
>>NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFI
>>CA
>> TION=C"
>> 
>> "-1" > "1"
>> [1] TRUE
>> 
>> "-1" <"1"
>> [1] FALSE
>> 
>> "1" < "-1"
>> [1] TRUE
>> 
>> "1" < "-"
>> [1] FALSE
>> 
>> Vs.
>> 
>> R version 3.1.1 (2014-07-10) ‹ ³Sock it to Me"
>> Platform: x86_64-redhat-linux-gnu (64-bit)
>> Sys.getlocale()
>> [1] 
>> 
>>"LC_CTYPE=en_US.utf8;LC_NUMERIC=C;LC_TIME=en_US.utf8;LC_COLLATE=en_US.utf
>>8
>> 
>>;LC_MONETARY=en_US.utf8;LC_MESSAGES=en_US.utf8;LC_PAPER=en_US.utf8;LC_NAM
>>E
>> 
>>=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.utf8;LC_IDENTIFICATIO
>>N
>> =C"
>> 
>> "-1" > "1"
>> [1] FALSE
>> 
>> "-1" <"1"
>> [1] TRUE
>> 
>> "1" < "-1"
>> [1] FALSE
>> 
>> "1" < "-"
>> [1] FALSE
>> 
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>> 
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] R string comparisons may vary with platform (plain text)

2014-11-22 Thread Duncan Murdoch
On 22/11/2014, 2:59 PM, Stuart Ambler wrote:
> A colleague¹s R program behaved differently when I ran it, and we thought
> we traced it probably to different results from string comparisons as
> below, with different R versions.  However the platforms also differed.  A
> friend ran it on a few machines and found that the comparison behavior
> didn¹t correlate with R version, but rather with platform.
> 
> I wonder if you¹ve seen this.  If it¹s not some setting I¹m unaware of,
> maybe someone should look into it.  Sorry I haven¹t taken the time to read
> the source code myself.

Looks like a collation order issue.  See ?Comparison.

Duncan Murdoch

> Thanks,
> Stuart
> 
> R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
> Platform: x86_64-unknown-linux-gnu (64-bit)
> Sys.getlocale()
> [1] 
> "LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF
> -8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_
> NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICA
> TION=C"
> 
> "-1" > "1"
> [1] TRUE
> 
> "-1" <"1"
> [1] FALSE
> 
> "1" < "-1"
> [1] TRUE
> 
> "1" < "-"
> [1] FALSE
> 
> Vs.
> 
> R version 3.1.1 (2014-07-10) ‹ ³Sock it to Me"
> Platform: x86_64-redhat-linux-gnu (64-bit)
> Sys.getlocale()
> [1] 
> "LC_CTYPE=en_US.utf8;LC_NUMERIC=C;LC_TIME=en_US.utf8;LC_COLLATE=en_US.utf8
> ;LC_MONETARY=en_US.utf8;LC_MESSAGES=en_US.utf8;LC_PAPER=en_US.utf8;LC_NAME
> =C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.utf8;LC_IDENTIFICATION
> =C"
> 
> "-1" > "1"
> [1] FALSE
> 
> "-1" <"1"
> [1] TRUE
> 
> "1" < "-1"
> [1] FALSE
> 
> "1" < "-"
> [1] FALSE
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] R string comparisons may vary with platform (plain text)

2014-11-22 Thread Stuart Ambler
A colleague¹s R program behaved differently when I ran it, and we thought
we traced it probably to different results from string comparisons as
below, with different R versions.  However the platforms also differed.  A
friend ran it on a few machines and found that the comparison behavior
didn¹t correlate with R version, but rather with platform.

I wonder if you¹ve seen this.  If it¹s not some setting I¹m unaware of,
maybe someone should look into it.  Sorry I haven¹t taken the time to read
the source code myself.

Thanks,
Stuart

R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
Platform: x86_64-unknown-linux-gnu (64-bit)
Sys.getlocale()
[1] 
"LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF
-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_
NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICA
TION=C"

"-1" > "1"
[1] TRUE

"-1" <"1"
[1] FALSE

"1" < "-1"
[1] TRUE

"1" < "-"
[1] FALSE

Vs.

R version 3.1.1 (2014-07-10) ‹ ³Sock it to Me"
Platform: x86_64-redhat-linux-gnu (64-bit)
Sys.getlocale()
[1] 
"LC_CTYPE=en_US.utf8;LC_NUMERIC=C;LC_TIME=en_US.utf8;LC_COLLATE=en_US.utf8
;LC_MONETARY=en_US.utf8;LC_MESSAGES=en_US.utf8;LC_PAPER=en_US.utf8;LC_NAME
=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.utf8;LC_IDENTIFICATION
=C"

"-1" > "1"
[1] FALSE

"-1" <"1"
[1] TRUE

"1" < "-1"
[1] FALSE

"1" < "-"
[1] FALSE

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Large size shared library

2014-11-22 Thread Prof Brian Ripley

On 22/11/2014 08:34, Chen, Han wrote:

Dear all,

I have an R package that I plan to submit to CRAN in the near
future,

but it gave me a note when I ran "R CMD check --as-cran" saying that my
libs directory is 7.0Mb. I wrote some functions in C++ and my source
code included several low-level C++ libraries as header files. When I
compiled manually using g++ without the -g flag, my shared library (.so)
was about 400Kb; but when I compiled with the -g flag, it was about
7.0Mb... I am assuming there was a lot of debugging information created
when I turned on -g, possibly because the compiler had to look for a lot
of classes and functions in low-level C++ libraries, but I am worried
that the package would fail CRAN check due to the large size .so file
created (it seems R has -g flag on by default when compiling C/C++ code
according to ${R_HOME}/etc/Makeconf). Does anyone have any suggestions
on how I could possibly make my shared library file smaller? Even though
I can compile it manually without the -g flag, general users will !

use R default to install the package and it could take a lot of
space.


Thanks in advance!

7MB is not 'a lot of space'.  There are CRAN packages which compiled 
with -g take ca 80MB.



Best,
Han

-
Han Chen, Ph.D.
Postdoctoral Research Fellow
Department of Biostatistics
Harvard School of Public Health
http://www.hsph.harvard.edu/han-chen/


[[alternative HTML version deleted]]


Please do follow the posting guide and not send HTML.


--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Large size shared library

2014-11-22 Thread Chen, Han
Dear all,

I have an R package that I plan to submit to CRAN in the near future, but it 
gave me a note when I ran "R CMD check --as-cran" saying that my libs directory 
is 7.0Mb. I wrote some functions in C++ and my source code included several 
low-level C++ libraries as header files. When I compiled manually using g++ 
without the -g flag, my shared library (.so) was about 400Kb; but when I 
compiled with the -g flag, it was about 7.0Mb... I am assuming there was a lot 
of debugging information created when I turned on -g, possibly because the 
compiler had to look for a lot of classes and functions in low-level C++ 
libraries, but I am worried that the package would fail CRAN check due to the 
large size .so file created (it seems R has -g flag on by default when 
compiling C/C++ code according to ${R_HOME}/etc/Makeconf). Does anyone have any 
suggestions on how I could possibly make my shared library file smaller? Even 
though I can compile it manually without the -g flag, general users will !
 use R default to install the package and it could take a lot of space. Thanks 
in advance!

Best,
Han

-
Han Chen, Ph.D.
Postdoctoral Research Fellow
Department of Biostatistics
Harvard School of Public Health
http://www.hsph.harvard.edu/han-chen/


[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel