Skip to content

[R-pkg-devel] Running tests on 32-bit and 64-bit

5 messages · Uwe Ligges, Duncan Murdoch, Kasper Daniel Hansen +1 more

#
Dear all,

Is there an easy way to run the tests of a package on both a 32-bit and
64-bit version? Ideally it should work when using R CMD check --as-cran on
all OS's. Although I expect that multi architecture versions are only
available on windows. So a Windows only solution will be fine as well.

The origin of the problem is that I calculate some SHA1 hashed on objects
containing floating point numbers. The floating points have different
precision on 32-bit and 64-bit, and thus different hashes. I'm trying to
work around that problem. And thus need an easy way to run tests on both
32-bit and 64-bit.

Best regards,

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
#
Use winbuilder, it runs 32-bit and 64-bit R tests on a Windows 64-bit 
platform. Not sure how you implemented the different precisions, but 
just go ahead and try on winbiulder.

Best,
Uwe Ligges
On 17.08.2015 11:03, Thierry Onkelinx wrote:
#
On 17/08/2015 5:03 AM, Thierry Onkelinx wrote:
I'm not sure I see the problem.  If you install both the 32 and 64 bit
versions, then you can run whichever one you want. To run both, just
give the full path to the R.exe executables when you run the tests.

Duncan Murdoch
#
Perhaps related: in the Bioconductor minfi package I do some checking on
somewhat large matrices (450,000 times n).  To save space, I compute a hash
of the correct result using the digest package.  As you, I ran into obvious
issues with precision across platforms.  To solve this, I take the matrix
and run it through sprintf() with (my choice) 6 digits and then I hash the
resulting character matrix.  It works pretty nice for my purpose.

You find minfi on github.  Code is in
  inst/unitTests/test_preprocess.R  (testing using Runit)
  inst/testData/testData/testData_preprocessQuantile.R (creating the
reference "correct" matrix - this is only intended to be re-run when the
algorithm change)
  R/utils.R for the two convenience functions .digestMatrix and
.digestVector

Best,
Kasper

On Mon, Aug 17, 2015 at 5:03 AM, Thierry Onkelinx <thierry.onkelinx at inbo.be>
wrote:

  
  
2 days later
#
Dear all,

Thanks for the feedback.

@Uwe
I'll have a look at winbuilder. Can it handle non-CRAN dependencies?
E.g. packages which are available on github or bitbucket?
I was rather looking for something which can run on my local machine.
That would give me faster feedback than a remote system. My current
setup is development on Win 32-bit and continuous integration on Linux
64-bit.

@Duncan
I was hoping for something as easy to use as devtools::test() I ended
by creating test_both() Feedback on the function is welcome.

test_both <- function(path = "."){
  path <- normalizePath(".", winslash = "/")
  commands <- paste0(
    Sys.getenv("R_HOME"),
    "/bin/",
    c("i386/", "x64/"),
    "Rscript.exe -e devtools::test('",
    path,
    "')"
  )
  for (command in commands) {
    system(command)
  }
}

@Kasper
Thanks for the suggestions. I tried both to use signif() and
sprintf("%f"), but both fail for time to time. My current solutions is
based on sprintf("%a"). num_32_64() converts numerics into a string
which is identical on both architecture. get_sha1() calculates the
SHA1 for different kinds of objects. You can find the code at
http://bitbucket.org/thierry_onkelinx/n2khelper

Best regards,

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium

To call in the statistician after the experiment is done may be no
more than asking him to perform a post-mortem examination: he may be
able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does
not ensure that a reasonable answer can be extracted from a given body
of data. ~ John Tukey


2015-08-17 14:21 GMT+02:00 Kasper Daniel Hansen <kasperdanielhansen at gmail.com>: