1. home
  2. #tags
  3. Fortran

Discover Latest #Fortran News, Articles and Videos with Contenting

Fortran is a programming language that has been around since the 1950s. It is one of the oldest programming languages still in use today and is the primary language used in scientific computing and engineering applications. The language has seen a resurgence in popularity in recent years due to its ability to integrate with high-level languages such as Python and C++. This makes it an ideal choice for data-intensive projects and applications. Here you will find news, articles and videos related to the language.

Secure your website wherever you are (Sponsored by SSLs.com)

Show your company is legit, from $36.88ad

Buy a domain and everything else you need (Sponsored By namecheap.com)


Options to install R on a Raspberry Pi and other ARM systems | R-bloggers

Install from the Operating System’s repositories Compile R from source Install R using rig Install R from the R4Pi Project This started out as a section in some of my other posts but as installation options started to pile up it began to take too much space to be just a section in an article so I’ve decided to turn it into an article of its own. The options described here are mostly applicable to the Raspberry Pi family of Single Board Computers but since most of them also work on Ubuntu distributions tehy can also be applicable to other Linux ARM systems like other SBCs or even “full-size” ARM computers like Ampere Altra or AWS Graviton. Install from the Operating System’s repositories This is the easiest option, you can install R from the standard repositories for your OS but those R versions are usually quite old, for example, Raspberry Pi OS comes with R 4.0.0 and Ubuntu 22.04 comes with R 4.1.2. To install R with this option you just need to run this command in your system terminal: sudo apt install r-base This is fine if you just want to try R or do simple stuff with it but if you are going to work on a serious project, chances are you want to start with an up-to-date version of R instead. Compile R from source Another option is to compile the latest R version yourself (4.2.2 at the moment of writing) from the source code files, this is a time-consuming task and it might fill a little intimidating for newcomers but it gives you the most flexibility when it comes to setup compilation options, for example, you can choose options like compiling with BLAS and LAPACK to speed up matrix calculations. You can compile R from source by running this script on a system terminal, it works for both Raspberry Pi OS and Ubuntu distributions: sudo su # Set the R version to install R_VERSION=4.2.2 apt install -y g++ gcc gfortran libreadline-dev libx11-dev libxt-dev \ libpng-dev libjpeg-dev libcairo2-dev xvfb \ libbz2-dev libzstd-dev liblzma-dev libtiff5 \ libssh-dev libgit2-dev libcurl4-openssl-dev \ libblas-dev liblapack-dev libopenblas-base \ zlib1g-dev openjdk-11-jdk \ texinfo texlive texlive-fonts-extra \ screen wget libpcre2-dev make cmake cd /usr/local/src wget https://cran.rstudio.com/src/base/R-${R_VERSION:0:1}/R-$R_VERSION.tar.gz tar zxvf R-$R_VERSION.tar.gz cd R-$R_VERSION ./configure --enable-R-shlib --enable-memory-profiling --with-blas --with-lapack #BLAS and LAPACK are optional make make install cd .. rm -rf R-$R_VERSION* exit Install R using rig rig is an R installation manager that allows you to install multiple R versions side by side, recently, it has added support for Linux ARM64 systems trough the rstudio/r-builds GitHub repository, although, these builds are stated to be a community resource, they are not professionally supported by Posit. It currently supports only Ubuntu and Debian distributions (Raspberry Pi OS is based on Debian 11 so it is compatible too). You can install rig in your system by running this command on a system terminal: curl -Ls https://github.com/r-lib/rig/releases/download/latest/rig-linux-arm64-latest.tar.gz | sudo tar xz -C /usr/local Then you can install the latest stable R version with these commands: sudo rig add release # Or an specific version like 4.2.2 sudo rig default release Optionally, you can manually download and install R from the rstudio/r-builds GitHub repository directly but this a more involved procedure only worthy if you are going to integrate this into your own infrastructure management workflow and you want to avoid the overhead of installing rig. Install R from the R4Pi Project And last but not least, my new favorite, you can install R from the R4Pi project through its deb repository, currently, only supports Raspberry Pi OS, both 32 and 64 bits, and possibly other Debian 11 based distributions like Ubuntu 18, but it is not guaranteed. To add the R4Pi deb repository to your deb source list and install R run these commands on a system terminal: curl -O https://pkgs.r4pi.org/dl/r4pi-repo-conf_0.0.1-1_all.deb sudo dpkg -i r4pi-repo-conf_0.0.1-1_all.deb sudo apt update sudo apt upgrade sudo apt install r4pi rm r4pi-repo-conf_0.0.1-1_all.deb The main benefit of the R4Pi project is that it also provides R package repositories with precompiled binaries for a big selection of R packages which greatly reduces the time and effort required to install R packages on the Raspberry Pi, and by the way, you can also use the R4Pi package repository with all the previous options just by setting the “repos” option in a .Rprofile file. local({r

R-universe now builds MacOS ARM64 binaries for use on Apple Silicon (aka M1/M2/M3) systems | R-bloggers

Abstract / TLDR R-universe now provides MacOS arm64 binaries for all R packages. This means that MacOS users on Apple Silicon hardware (aka M1/M2/M3) can install the very latest builds of any R package without the need for any compilation: install.packages('arrow', repos = c('https://apache.r-universe.dev', 'https://cloud.r-project.org')) R-universe uses cross-compiling for arm64 binaries, though this should not make much of a difference for package authors and R users. Packages with C/C++/Fortran/Rust code are all supported. Why cross compiling Because GitHub Actions currently does not offer arm64 runners for OSS projects, the arm64 binaries are cross-compiled on the MacOS intel runners. The cross build environment is set up to mimic a native arm64 machine, such that most R packages do not need any modification to work. We found only a small number of packages with a buggy configure script that may need a fix to allow cross-compilation. The r-universe workflow only builds arm64 binaries when needed, i.e. for packages that include compiled code (C/C++/Fortran/Rust). Packages that do not include any compiled code are portable by design, so for these packages the binaries built for MacOS on intel are served both in the x86_64 and arm64 cranlike repositories, without the need for an additional cross compile step. Just like CRAN, the r-universe package homepage shows a link to the r-4.3-x86_64 and r-4.3-arm64 binaries. Packages without compiled code have a r-4.3-any binary which is used for either architecture. To have a look at the build logs, click on the little apple icon next to these links. Alternatively, you can use the /buildlog shortlink, for example https://apache.r-universe.dev/arrow/buildlog will take you to the latest arrow builds. On this page you can find the arm64 build log specifically by expanding the r-release-macos job and then under the section “Cross Compile for MacOS ARM64”. If this section is disabled, it means it was skipped because this package does not have compiled code, and does not need cross compilation. Some technical details For those interested how the cross compilation is set up, here are the main ingredients: The standard MacOS Xcode toolchains are used to cross compile C/C++ code by passing the -arch arm64 flag to clang and clang++. The universal gfortran 12.2 version from CRAN (thanks to Simon Urbanek) is used to cross compile fortran code, also by passing gfortran -arch arm64. The same collection of system libs used by CRAN is preinstalled in the build environment. R packages with a configure script are built with --configure-args="--build=x86_64-apple-darwin20 --host=aarch64-apple-darwin20". These flags are needed by autoconf scripts, but other packages can use them as well. The r-universe macos-cross workflow overrides some more files and variables to target arm64. We put some shell shims on the PATH to help packages that shell out to uname or arch to determine the architecture. A clever cargo shim is used to override the default cargo build target to aarch64-apple-darwin and copy outputs to the expected directory after the build. Packages are built with strict linking (without the -undefined dynamic_lookup flag). With this setup, almost any R package can be built in the cross environment exactly the same way they do on normal arm64 hardware. But if your package does not work and you need some help fixing it, please feel free to open an issue. Universal binaries Finally, some R packages download precompiled binaries for libraries too big or complicated to build on the fly. It is safest to distribute such libraries in the form of universal binaries which contain both the x86_64 and arm64 libs. This way your download script does not need to make any guesses about the target architecture it is building for: the same libs can be linked on either target. Creating a universal binary can be done for both static and dynamic libraries and is really easy. If you have a x86_64 and arm64 version of libfoo.a you can glue them together with lipo: lipo -create x86_64/libfoo.a arm64/libfoo.a -output universal/libfoo.a And this new libfoo.a can be used when building either for intel or arm. Again if you need any help with this feel free to reach out.