This can, be a hard debug, as the error does not show up where the error occure.
Reduce the model so that it works and try to add things back in, one at the
time. Always using num.threads=1
Most likely issue, is that you return something that is to short hence it will
read an address not ment to
use 'inla.rgeneric.q' to check, carefully the output sent back from your
rgeneric.
On Tue, 2024-11-26 at 16:13 -0800, Ruby Ji wrote:
> Dear INLA experts,
> I recently ran a model on my Windows machine, and it worked well. However,
> when I attempted to run the same model on a Linux HPC, I encountered the
> following error:
> *** caught segfault ***
> address (nil), cause 'unknown'
>
> Traceback:
> 1: solve.default(Ts)
> 2: solve(Ts)
> 3: dt.fem.laplace(mesh, h1, h2)
> 4: inla.aniso.fem(mesh = mesh, h1 = theta.full[5], h2 = theta.full[6])
> 5: graph(numeric(0))
> 6: do.call(match.arg(cmd), args = list(theta))
> 7: (function (cmd = c("graph", "Q", "mu", "initial", "log.norm.const",
> "log.prior", "quit"), theta = NULL) { envir = parent.env(environment())
> prior.range1 <- obj$prior.range1 prior.sigma1 <- obj$prior.sigma1
> prior.range2 <- obj$prior.range2 prior.sigma2 <- obj$prior.sigma2
> prior.h1 <- obj$prior.h1 prior.h2 <- obj$prior.h2 mesh <- obj$mesh
> inla.aniso.fem <- obj$inla.aniso.fem inla.aniso.q.2latents.sameH <-
> obj$inla.aniso.q.2latents.sameH initial <- function(theta) {
> initial.theta <- c(0, 0, 0, 0, 0, 0) return(initial.theta) }
> log.prior <- function(theta) { val <- 0 lambda1 <- -
> log(prior.range1[2]) * prior.range1[1] val <- val + log(lambda1) -
> lambda1 * exp(-theta[1]) + -theta[1] lambda2 <- -
> log(prior.sigma1[2])/prior.sigma1[1] val <- val + log(lambda2) -
> lambda2 * exp(theta[2]) + theta[2] lambda3 <- -
> log(prior.range2[2]) * prior.range2[1] val <- val + log(lambda3) -
> lambda3 * exp(-theta[3]) + -theta[3] lambda4 <- -
> log(prior.sigma2[2])/prior.sigma2[1] val <- val + log(lambda4) -
> lambda4 * exp(theta[4]) + theta[4] val <- val +
> dnorm(theta[5], mean = prior.h1[1], sd = prior.h1[2], log = TRUE)
> val <- val + dnorm(theta[6], mean = prior.h2[1], sd = prior.h2[2],
> log = TRUE) return(val) } Q <- function(theta) {
> theta.full <- theta stopifnot(length(theta.full) == 6) fem <-
> inla.aniso.fem(mesh = mesh, h1 = theta.full[5], h2 =
> theta.full[6]) Q <- inla.aniso.q.2latents.sameH(fem = fem, range1 =
> exp(theta.full[1]), sigma1 = exp(theta.full[2]), range2 =
> exp(theta.full[3]), sigma2 = exp(theta.full[4]), envir = envir)
> return(Q) } graph <- function(theta) { ntheta <- 6
> theta.full <- (1:ntheta)/3.217233456 fem <- inla.aniso.fem(mesh =
> mesh, h1 = theta.full[5], h2 = theta.full[6]) G1 <-
> inla.aniso.q.2latents.sameH(fem = fem, range1 = exp(theta.full[1]),
> sigma1 = exp(theta.full[2]), range2 = exp(theta.full[3]), sigma2
> = exp(theta.full[4])) G1[G1 != 0] <- 1 theta.full <-
> (1:ntheta)^2/12.1543534 fem <- inla.aniso.fem(mesh = mesh, h1 =
> theta.full[5], h2 = theta.full[6]) G2 <-
> inla.aniso.q.2latents.sameH(fem = fem, range1 = exp(theta.full[1]),
> sigma1 = exp(theta.full[2]), range2 = exp(theta.full[3]), sigma2
> = exp(theta.full[4])) G2[G2 != 0] <- 1 return(G1 + G2) }
> mu <- function(theta) numeric(0) log.norm.const <- function(theta)
> numeric(0) quit <- function(theta) invisible() val <-
> do.call(match.arg(cmd), args = list(theta)) return(val)})(cmd = "graph",
> theta = numeric(0))
> 8: do.call(model$definition, args = list(cmd = cmd, theta = theta))
> 9: INLA::inla.rgeneric.wrapper(cmd, model, theta)
> 10: inla.rgeneric.wrapper("graph", ".
inla.rgeneric.model.sz", numeric(0))
>
> Possible actions:
> 1: abort (with core dump, if enabled)
> Selection:
> 3: exit R without saving workspace
> 4: exit R saving workspace
> Selection:
> I have ensured that the INLA package is properly installed on the Linux
> system, and my R version matches the one I used on Windows. Additionally, the
> model input data and code remain unchanged between the two environments.
> Could you please help me identify the cause of this issue and suggest possible
> solutions? If more details about my setup are needed, I am happy to provide
> them.
> Thank you for your assistance!
> Ruby
>
> --
> You received this message because you are subscribed to the Google Groups "R-
> inla discussion group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
r-inla-discussion...@googlegroups.com.
> To view this discussion, visit
>
https://groups.google.com/d/msgid/r-inla-discussion-group/e461d69c-db15-4c81-ba2b-49f4e5e4f018n%40googlegroups.com
> .
--
Håvard Rue
he...@r-inla.org