<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.bwhpc.de/wiki/index.php?action=history&amp;feed=atom&amp;title=BwUniCluster3.0%2FSoftware%2FR%2FRjags</id>
	<title>BwUniCluster3.0/Software/R/Rjags - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.bwhpc.de/wiki/index.php?action=history&amp;feed=atom&amp;title=BwUniCluster3.0%2FSoftware%2FR%2FRjags"/>
	<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=BwUniCluster3.0/Software/R/Rjags&amp;action=history"/>
	<updated>2026-05-13T23:55:35Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.17</generator>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=BwUniCluster3.0/Software/R/Rjags&amp;diff=15078&amp;oldid=prev</id>
		<title>K Kuck: Created page with &quot;= General information =  rjags is an R interface to use JAGS, [https://mcmc-jags.sourceforge.io/ Just another Gibbs Sampler], a program for analysis of Bayesian hierarchical models using Markov Chain Monte Carlo (MCMC) simulation  = Installation instructions = &lt;code&gt;rjags&lt;/code&gt; needs a working JAGS installation. The following instructions will build and install JAGS 4.3.2 to &lt;code&gt;$JAGS_HOME&lt;/code&gt; on bwUniCluster 3.0.  First, in order to compile them on a compute node,...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=BwUniCluster3.0/Software/R/Rjags&amp;diff=15078&amp;oldid=prev"/>
		<updated>2025-07-15T08:20:11Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;= General information =  rjags is an R interface to use JAGS, [https://mcmc-jags.sourceforge.io/ Just another Gibbs Sampler], a program for analysis of Bayesian hierarchical models using Markov Chain Monte Carlo (MCMC) simulation  = Installation instructions = &amp;lt;code&amp;gt;rjags&amp;lt;/code&amp;gt; needs a working JAGS installation. The following instructions will build and install JAGS 4.3.2 to &amp;lt;code&amp;gt;$JAGS_HOME&amp;lt;/code&amp;gt; on bwUniCluster 3.0.  First, in order to compile them on a compute node,...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= General information =&lt;br /&gt;
&lt;br /&gt;
rjags is an R interface to use JAGS, [https://mcmc-jags.sourceforge.io/ Just another Gibbs Sampler], a program for analysis of Bayesian hierarchical models using Markov Chain Monte Carlo (MCMC) simulation&lt;br /&gt;
&lt;br /&gt;
= Installation instructions =&lt;br /&gt;
&amp;lt;code&amp;gt;rjags&amp;lt;/code&amp;gt; needs a working JAGS installation. The following instructions will build and install JAGS 4.3.2 to &amp;lt;code&amp;gt;$JAGS_HOME&amp;lt;/code&amp;gt; on bwUniCluster 3.0.&lt;br /&gt;
&lt;br /&gt;
First, in order to compile them on a compute node, we obtain an interactive session:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Obtain interactive batch session&lt;br /&gt;
salloc -p dev_cpu -N1 --ntasks-per-node 4 -t 30 --mem=4096&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Install external dependencies ==&lt;br /&gt;
Then we download and compile JAGS using GCC 11.4:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Load required modules.&lt;br /&gt;
module purge&lt;br /&gt;
module load math/R&lt;br /&gt;
&lt;br /&gt;
# Set up JAGS installation directory.&lt;br /&gt;
export JAGS_HOME=&amp;quot;$HOME/sw/jags&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Set up source directory.&lt;br /&gt;
mkdir -p ~/src&lt;br /&gt;
cd ~/src&lt;br /&gt;
&lt;br /&gt;
# Download JAGS source.&lt;br /&gt;
wget https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Source/JAGS-4.3.2.tar.gz&lt;br /&gt;
tar -xf JAGS-4.3.2.tar.gz&lt;br /&gt;
rm JAGS-4.3.2.tar.gz&lt;br /&gt;
cd JAGS-4.3.2&lt;br /&gt;
&lt;br /&gt;
# Compile JAGS.&lt;br /&gt;
export CFLAGS=&amp;quot;-O3 -fPIC -malign-data=cacheline -finline-functions -m64 -Wno-implicit-function-declaration&amp;quot;&lt;br /&gt;
export CXXFLAGS=&amp;quot;-O3 -fPIC -malign-data=cacheline -finline-functions -m64 -std=c++23 -Wno-implicit-function-declaration&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./configure  --prefix=&amp;quot;$JAGS_HOME&amp;quot; --with-blas=&amp;quot;-lopenblas&amp;quot;&lt;br /&gt;
make -j 4&lt;br /&gt;
make install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Install &amp;lt;code&amp;gt;rjags&amp;lt;/code&amp;gt; in R ==&lt;br /&gt;
&lt;br /&gt;
=== Preparations ===&lt;br /&gt;
Prepare an &amp;lt;code&amp;gt;.R/Makevars&amp;lt;/code&amp;gt; file (if it does not already exist). This file specifies how R should compile the packages (i.e., sets some &amp;#039;compiler flags&amp;#039;).&lt;br /&gt;
&lt;br /&gt;
If an &amp;lt;code&amp;gt;.R/Makevars&amp;lt;/code&amp;gt; file is present in your home directory (&amp;lt;code&amp;gt;$HOME&amp;lt;/code&amp;gt;), check whether the flags displayed below are already set and apply adjustments, if necessary:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat $HOME/.R/Makevars&lt;br /&gt;
&lt;br /&gt;
CXX14=g++&lt;br /&gt;
CXX17=g++&lt;br /&gt;
CFLAGS+=-O3 -fPIC -malign-data=cacheline -finline-functions -m64 -Wno-implicit-function-declaration&lt;br /&gt;
CXXFLAGS+=-O3 -fPIC -malign-data=cacheline -finline-functions -m64 -Wno-implicit-function-declaration&lt;br /&gt;
CXX14FLAGS += -std=c++14&lt;br /&gt;
CXX17FLAGS += -std=c++17 -fPIC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please run the following lines of code to set the flags, if necessary:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p ~/.R&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;CXX14=g++&amp;quot; &amp;gt; $HOME/.R/Makevars&lt;br /&gt;
echo &amp;quot;CXX17=g++&amp;quot; &amp;gt;&amp;gt; $HOME/.R/Makevars&lt;br /&gt;
echo &amp;quot;CFLAGS+=-O3 -fPIC -malign-data=cacheline -finline-functions -m64 -Wno-implicit-function-declaration&amp;quot; &amp;gt;&amp;gt; $HOME/.R/Makevars&lt;br /&gt;
echo &amp;quot;CXXFLAGS+=-O3 -fPIC -malign-data=cacheline -finline-functions -m64 -Wno-implicit-function-declaration&amp;quot; &amp;gt;&amp;gt; $HOME/.R/Makevars&lt;br /&gt;
echo &amp;quot;CXX14FLAGS += -std=c++14&amp;quot; &amp;gt;&amp;gt; $HOME/.R/Makevars&lt;br /&gt;
echo &amp;quot;CXX17FLAGS += -std=c++17 -fPIC&amp;quot; &amp;gt;&amp;gt; $HOME/.R/Makevars&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install &amp;lt;code&amp;gt;rjags&amp;lt;/code&amp;gt; package ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Set up environment and install JAGS within R session.&lt;br /&gt;
export PKG_CONFIG_PATH=$JAGS_HOME/lib/pkgconfig&lt;br /&gt;
export LD_RUN_PATH=$JAGS_HOME/lib&lt;br /&gt;
&lt;br /&gt;
R -q&lt;br /&gt;
&amp;gt; install.packages(&amp;quot;rjags&amp;quot;, configure.args=&amp;quot;--enable-rpath&amp;quot;)&lt;br /&gt;
&amp;gt; library(rjags)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Use &amp;lt;code&amp;gt;rjags&amp;lt;/code&amp;gt;=&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Set up environment&lt;br /&gt;
export JAGS_HOME=&amp;quot;$HOME/sw/jags&amp;quot;&lt;br /&gt;
export PATH=$JAGS_HOME/bin:$PATH&lt;br /&gt;
export PKG_CONFIG_PATH=$JAGS_HOME/lib/pkgconfig&lt;br /&gt;
export LD_RUN_PATH=$JAGS_HOME/lib&lt;br /&gt;
&lt;br /&gt;
R -q&lt;br /&gt;
&amp;gt; library(rjags)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>K Kuck</name></author>
	</entry>
</feed>