kaskr / adcomp

AD computation with Template Model Builder (TMB)
Other
175 stars 80 forks source link

runExample(all=TRUE) #5

Closed jlaake closed 10 years ago

jlaake commented 10 years ago

I received an error when running all examples as stated on github site. James Thorson suggested running the first example individually and that worked, The code for the run/error is shown below. After I ran first example separately then the runExample(all=TRUE) worked. --jeff

R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: i386-w64-mingw32/i386 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R.

This is RMark 2.1.8

[Previously saved workspace restored]

library(TMB) Loading required package: Matrix

Attaching package: ‘TMB’

The following object is masked from ‘package:stats’:

optimize

runExample(all=TRUE) Building example ar1xar1 make: Nothing to be done for `all'. Build time 0.43 seconds

Running example ar1xar1

require(TMB)

set.seed(123)

n <- 50 ## Size of problem = n*n

======================= Simulate separable 2D GMRF

- With exponential correlation in both directions

- phi1 = 1-lag correlation in 1st .... [TRUNCATED]

simgmrf <- function(n1,n2,phi1,phi2){

  • u <- matrix(rnorm(n1*n2),n1,n2)
  • L1 <- t(chol(ar1corr(n1,phi1)))
  • L2 <- t(chol(ar1corr(n2,phi2)))
  • .... [TRUNCATED]

    ======================= Simulate data

phi1=exp(-1/(.1*n)) ## Correlation range=10% of grid size first dimension

phi2=exp(-1/(.2*n)) ## Correlation range=20% of grid size second dimension

eta <- simgmrf(n,n,phi1,phi2)

N <- rpois(length(eta),exp(eta))

d <- expand.grid(x=factor(1:n),y=factor(1:n))

d$N <- N

======================= Parameterization of phi

f <- function(x) 2/(1 + exp(-2 * x)) - 1

invf <- function(y) -0.5 * log(2/(y + 1) - 1)

======================= Fit model

dyn.load(dynlib("ar1xar1"))

obj <- MakeADFun(data=list(N=N),

  • parameters=list(
  • eta=matrix(0,n,n),
  • transf_phi1=invf(0 .... [TRUNCATED] Order of parameters: [1] "eta" "transf_phi1" "transf_phi2" Not matching template order: [1] "\003\001‘\a\002" "`\a" "transf_phi2"
    Your parameter list has been re-ordered. (Disable this warning with checkParameterOrder=FALSE) Error in retape() : PARAMETER COMPONENT NOT A VECTOR!

Enter a frame number, or 0 to exit

1: runExample(all = TRUE) 2: lapply(exnames, runExample, thisR = thisR, clean = clean, ...) 3: FUN(c("ar1xar1", "ar1xar1_parallel", "atomic", "atomic_parallel", "linreg_parallel", "randomregression", "rw", "simple", "sumtest")[[1]], ...) 4: source(paste(name, ".R", sep = ""), echo = TRUE) 5: withVisible(eval(ei, envir)) 6: eval(ei, envir) 7: eval(expr, envir, enclos) 8: ar1xar1.R#35: MakeADFun(data = list(N = N), parameters = list(eta = matrix(0, n, n), transf_phi1 = invf(0.5), transf_phi2 = invf(0.5)), random = c("eta")) 9: retape()

kaskr commented 10 years ago

Thanks for the report, Jeff.

jlaake commented 10 years ago

Point 1, It is reproducible and got same error adding clean=TRUE.

Point 2. On R64, I get below not using and then using clean=TRUE. Does it not build 64 bit version?

R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R.

This is RMark 2.1.8

[Previously saved workspace restored]

library(TMB) Loading required package: Matrix

Attaching package: 'TMB'

The following object is masked from 'package:stats':

optimize

runExample(all=TRUE) Building example ar1xar1 make: Nothing to be done for `all'. Build time 0.2 seconds

Running example ar1xar1

require(TMB)

set.seed(123)

n <- 50 ## Size of problem = n*n

======================= Simulate separable 2D GMRF

- With exponential correlation in both directions

- phi1 = 1-lag correlation in 1st .... [TRUNCATED]

simgmrf <- function(n1,n2,phi1,phi2){

  • u <- matrix(rnorm(n1*n2),n1,n2)
  • L1 <- t(chol(ar1corr(n1,phi1)))
  • L2 <- t(chol(ar1corr(n2,phi2)))
  • .... [TRUNCATED]

======================= Simulate data

phi1=exp(-1/(.1*n)) ## Correlation range=10% of grid size first dimension

phi2=exp(-1/(.2*n)) ## Correlation range=20% of grid size second dimension

eta <- simgmrf(n,n,phi1,phi2)

N <- rpois(length(eta),exp(eta))

d <- expand.grid(x=factor(1:n),y=factor(1:n))

d$N <- N

======================= Parameterization of phi

f <- function(x) 2/(1 + exp(-2 * x)) - 1

invf <- function(y) -0.5 * log(2/(y + 1) - 1)

======================= Fit model

dyn.load(dynlib("ar1xar1")) Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/examples/ar1xar1.dll': LoadLibrary failure: %1 is not a valid Win32 application.

Enter a frame number, or 0 to exit

1: runExample(all = TRUE) 2: lapply(exnames, runExample, thisR = thisR, clean = clean, ...) 3: FUN(c("ar1xar1", "ar1xar1_parallel", "atomic", "atomic_parallel", "linreg_p 4: source(paste(name, ".R", sep = ""), echo = TRUE) 5: withVisible(eval(ei, envir)) 6: eval(ei, envir) 7: eval(expr, envir, enclos) 8: ar1xar1.R#34: dyn.load(dynlib("ar1xar1")) 9: inDL(x, as.logical(local), as.logical(now), ...)

Selection: 0

runExample(all=TRUE,clean=TRUE) Cleanup: Building example ar1xar1 g++ -m64 -I"C:/PROGRA~1/R/R-30~1.2/include" -DNDEBUG -IC:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include -DTMB_SAFEBOUNDS -DLIB_UNLOAD=R_unload_ar1xar1 -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -mtune=core2 -c ar1xar1.cpp -o ar1xar1.o In file included from C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/TMB.hpp:46:0, from ar1xar1.cpp:2: C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/tmb_core.hpp: In function 'SEXPREC* MakeADFunObject(SEXP, SEXP, SEXP, SEXP)': C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/tmb_core.hpp:734:9: warning: unused variable 'n' [-Wunused-variable] C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/tmb_core.hpp: In function 'SEXPREC* MakeADGradObject(SEXP, SEXP, SEXP)': C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/tmb_core.hpp:939:9: warning: unused variable 'n' [-Wunused-variable] In file included from C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/ad.hpp:23:0, from C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/cppad.hpp:80, from C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/TMB.hpp:33, from ar1xar1.cpp:2: C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/player.hpp: In constructor 'CppAD::player::player() [with Base = double]': C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/fun_construct.hpp:395:19: instantiated from 'CppAD::ADFun::ADFun(const VectorAD&, const VectorAD&) [with ADvector = tmbutils::vectorCppAD::AD, Base = double]' C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/tmb_core.hpp:693:39: instantiated from here C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/player.hpp:69:21: warning: 'CppAD::player::rec_oparg' will be initialized after [-Wreorder] C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/player.hpp:60:19: warning: 'CppAD::pod_vector CppAD::player::recpar' [-Wreorder] C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/player.hpp:72:2: warning: when initialized here [-Wreorder] In file included from C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/drivers.hpp:47:0, from C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/ad_fun.hpp:593, from C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/cppad.hpp:88, from C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/TMB.hpp:33, from ar1xar1.cpp:2: C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/rev_two.hpp: In member function 'VectorBase CppAD::ADFun::RevTwo(const VectorBase&, const VectorSize_t&, const VectorSize_t&) [with VectorBase = tmbutils::vector, VectorSize_t = tmbutils::vector, Base = double]': C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/tmbcore.hpp:657:7: instantiated from 'SEXPREC* EvalADFunObjectTemplate(SEXP, SEXP, SEXP) [with ADFunType = CppAD::ADFun, SEXP = SEXPREC]' C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/tmb_core.hpp:823:69: instantiated from here C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/rev_two.hpp:216:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] In file included from C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/ad.hpp:23:0, from C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/cppad.hpp:80, from C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/TMB.hpp:33, from ar1xar1.cpp:2: C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/player.hpp: In constructor 'CppAD::player::player() [with Base = CppAD::AD]': C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/fun_construct.hpp:395:19: instantiated from 'CppAD::ADFun::ADFun(const VectorAD&, const VectorAD&) [with ADvector = tmbutils::vectorCppAD::AD<CppAD::AD , Base = CppAD::AD]' C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/tmb_core.hpp:915:35: instantiated from here C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/player.hpp:69:21: warning: 'CppAD::playerCppAD::AD::rec_oparg' will be initialized after [-Wreorder] C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/player.hpp:60:19: warning: 'CppAD::pod_vectorCppAD::AD CppAD::playerCppAD::AD::recpar' [-Wreorder] C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/player.hpp:72:2: warning: when initialized here [-Wreorder] C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/player.hpp: In constructor 'CppAD::player::player() [with Base = CppAD::ADCppAD::AD]': C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/fun_construct.hpp:395:19: instantiated from 'CppAD::ADFun::ADFun(const VectorAD&, const VectorAD&) [with ADvector = tmbutils::vectorCppAD::AD<CppAD::AD<CppAD::AD > >, Base = CppAD::ADCppAD::AD]' C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/tmb_core.hpp:1081:40: instantiated from here C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/player.hpp:69:21: warning: 'CppAD::playerCppAD::AD<CppAD::AD >::rec_oparg' will be initialized after [-Wreorder] C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/player.hpp:60:19: warning: 'CppAD::pod_vectorCppAD::AD<CppAD::AD > CppAD::playerCppAD::AD<CppAD::AD >::recpar' [-Wreorder] C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/player.hpp:72:2: warning: when initialized here [-Wreorder] In file included from C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/ad_fun.hpp:297:0, from C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/cppad.hpp:88, from C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/TMB.hpp:33, from ar1xar1.cpp:2: C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/kasper.hpp: In member function 'void CppAD::ADFun::markArgs(CppAD::tape_point&) [with Base = CppAD::AD]': C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/kasper.hpp:529:5: instantiated from 'void CppAD::ADFun::my_init(CppAD::vector) [with Base = CppAD::AD]' C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/tmb_core.hpp:1096:23: instantiated from here C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/kasper.hpp:69:21: warning: unused variable 'CompareOpName' [-Wunused-variable] C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/kasper.hpp:71:21: warning: unused variable 'OpName' [-Wunused-variable] In file included from C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/ad_fun.hpp:581:0, from C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/cppad.hpp:88, from C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/TMB.hpp:33, from ar1xar1.cpp:2: C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/reverse_sweep.hpp: In function 'void CppAD::myReverseSweep(std::size_t, std::size_t, std::sizet, CppAD::player, std::sizet, const Base, std::sizet, Base, std::sizet, CppAD::ADFun) [with Base = CppAD::AD, std::size_t = long long unsigned int]': C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/reverse.hpp:289:2: instantiated from 'void CppAD::ADFun::myReverse(std::size_t, const VectorBase&, std::size_t, VectorBase&) [with VectorBase = tmbutils::vectorCppAD::AD, Base = CppAD::AD, std::size_t = long long unsigned int]' C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/tmb_core.hpp:1138:58: instantiated from here C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/cppad/local/reverse_sweep.hpp:682:17: warning: variable 'i_op' set but not used [-Wunused-but-set-variable] In file included from C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/TMB.hpp:46:0, from ar1xar1.cpp:2: C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/tmbcore.hpp: In function 'SEXPREC MakeADGradObject(SEXP, SEXP, SEXP)': C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/include/tmb_core.hpp:968:38: warning: 'res' may be used uninitialized in this function [-Wuninitialized] g++ -m64 -shared -s -static-libgcc -o ar1xar1.dll tmp.def ar1xar1.o -Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/PROGRA~1/R/R-30~1.2/bin/x64 -lR c:/rtools/gcc-4.6.3/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/bin/ld.exe: cannot open output file ar1xar1.dll: Permission denied collect2: ld returned 1 exit status Build time 18.41 seconds

Running example ar1xar1

require(TMB)

set.seed(123)

n <- 50 ## Size of problem = n*n

======================= Simulate separable 2D GMRF

- With exponential correlation in both directions

- phi1 = 1-lag correlation in 1st .... [TRUNCATED]

simgmrf <- function(n1,n2,phi1,phi2){

  • u <- matrix(rnorm(n1*n2),n1,n2)
  • L1 <- t(chol(ar1corr(n1,phi1)))
  • L2 <- t(chol(ar1corr(n2,phi2)))
  • .... [TRUNCATED]

======================= Simulate data

phi1=exp(-1/(.1*n)) ## Correlation range=10% of grid size first dimension

phi2=exp(-1/(.2*n)) ## Correlation range=20% of grid size second dimension

eta <- simgmrf(n,n,phi1,phi2)

N <- rpois(length(eta),exp(eta))

d <- expand.grid(x=factor(1:n),y=factor(1:n))

d$N <- N

======================= Parameterization of phi

f <- function(x) 2/(1 + exp(-2 * x)) - 1

invf <- function(y) -0.5 * log(2/(y + 1) - 1)

======================= Fit model

dyn.load(dynlib("ar1xar1")) Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'C:/Users/JLaake/Desktop/RHome/RLibrariesx86-32/TMB/examples/ar1xar1.dll': LoadLibrary failure: %1 is not a valid Win32 application. In addition: Warning message: In file.remove(dynlib(name)) : cannot remove file 'ar1xar1.dll', reason 'Permission denied'

Enter a frame number, or 0 to exit

1: runExample(all = TRUE, clean = TRUE) 2: lapply(exnames, runExample, thisR = thisR, clean = clean, ...) 3: FUN(c("ar1xar1", "ar1xar1_parallel", "atomic", "atomic_parallel", "linreg_parallel", "randomregression", "rw", "simple", "sumtest")[[1]], ...) 4: source(paste(name, ".R", sep = ""), echo = TRUE) 5: withVisible(eval(ei, envir)) 6: eval(ei, envir) 7: eval(expr, envir, enclos) 8: ar1xar1.R#34: dyn.load(dynlib("ar1xar1")) 9: inDL(x, as.logical(local), as.logical(now), ...)

Selection:

On Mon, Mar 3, 2014 at 9:39 AM, kaskr notifications@github.com wrote:

Thanks for the report, Jeff.

  • Is this reproducible, i.e. could you try to run "runExample(all=TRUE,clean=TRUE)" and see if you get the same error.
  • Can you try the same with 64 bit R? (If your machine has both versions of R).

Reply to this email directly or view it on GitHubhttps://github.com/kaskr/adcomp/issues/5#issuecomment-36535808 .

kaskr commented 10 years ago
  1. I can confirm there are some issues with TMB on windows 32 bit that I need to look into.
  2. I suspect the problems you had with 64 bit (permission denied to remove the old 32 bit DLLs) was because 32 bit R was open at the same time? Could you try it again? If still no permission, then re install TMB and try agin...
jlaake commented 10 years ago

Once I reinstalled and ran only in 64 bit R, everything worked perfectly. You can close this issue. I suggest adding a note under Windows that it doesn't run on R32 at present. Thanks.

regards --jeff

On Mon, Mar 3, 2014 at 12:21 PM, kaskr notifications@github.com wrote:

  1. I can confirm there are some issues with TMB on windows 32 bit that I need to look into.
  2. I suspect the problems you had with 64 bit (permission denied to remove the old 32 bit DLLs) was because 32 bit R was open at the same time? Could you try it again? If still no permission, then re install TMB and try agin...

Reply to this email directly or view it on GitHubhttps://github.com/kaskr/adcomp/issues/5#issuecomment-36554669 .