Code Monkey home page Code Monkey logo

crafty_brazil's Introduction

I study landscapes and how they change, often by using computational or statistical models

I also teach Spatial Data Science and environmental geography in my current role as Reader in Landscape Ecology in the Department of Geography at King's College London. See repos for some of my teaching materials here.

Python and R are my languages of choice, but I have previously used C++ and can hack away in Java. I regularly use spatial libraries from the pangeo project for Python, and the rspatial and r-spatial projects for R. See my gists here.

I'm currently working with the CRAFTY and WHAM! simulation models for studying land use/cover change in Brazil and global fire use, respectively. Recently completed a chapter for the Environmental Data Science book on Exploring Land Cover Data using Python, OpenDataCube and HoloViews.

Website ORCID Google Scholar LinkedIn

crafty_brazil's People

Contributors

jamesdamillington avatar lanecodes avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

lanecodes

crafty_brazil's Issues

CRAFTY Brazil does not run on Linux Mint due to problems with MPI configuration

I have had difficulties using CRAFTY Brazil on Linux Mint 20 (based on Ubuntu 20.04). Despite having Open MPI version 4.0.3 installed (installed with apt install openmpi). When attempting to run CRAFTY Brazil v1.0.1 I receive the following error.

Exception in thread "main" java.lang.UnsatisfiedLinkError: no savesignals in java.library.path
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
	at java.lang.Runtime.loadLibrary0(Runtime.java:871)
	at java.lang.System.loadLibrary(System.java:1124)
	at mpi.MPI.<clinit>(MPI.java:59)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at org.volante.abm.serialization.ModelRunner.main(ModelRunner.java:72)

To confirm the issue is specifically related to the use of MPI I commented out all references to MPI in ModelRunner.java and WorldLoader.java, and successfully ran the model. To further isolate the problem I wrote the following short test program and saved it as src/DemoMpiUnsatisfiedLinkError.java within the CRAFTY Brazil project.

import mpi.MPI;
import mpi.MPIException;
    
public class DemoMpiUnsatisfiedLinkError {
    
  public static void main(String[] args) throws MPIException {
    System.out.println("Started MPI test");
    String libPath = System.getProperty("java.library.path");
    System.out.println(libPath);    
    String[] mpiArgs = MPI.Init(args);
  }
    
}

This is compiled and run using only the lib/mpi.jar file on the classpath with

CRAFTY_HOME=/home/andrew/Documents/codes/crafty-brazil/CRAFTY_Brazil
# Compile test program
javac -classpath $CRAFTY_HOME/lib/mpi.jar \
-d $CRAFTY_HOME/bin \
$CRAFTY_HOME/src/DemoMpiUnsatisfiedLinkError.java
# Run test program
/usr/lib/jvm/bellsoft-java8-full-amd64/bin/java \
-classpath $CRAFTY_HOME/lib/mpi.jar:$CRAFTY_HOME/bin \
DemoMpiUnsatisfiedLinkError

Producing the output

Started MPI test
/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Exception in thread "main" java.lang.UnsatisfiedLinkError: no savesignals in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
        at java.lang.Runtime.loadLibrary0(Runtime.java:871)
        at java.lang.System.loadLibrary(System.java:1124)
        at mpi.MPI.<clinit>(MPI.java:59)
        at DemoMpiUnsatisfiedLinkError.main(DemoMpiUnsatisfiedLinkError.java:10)

I can see mpi.jar was copied into the lib directory of the CRAFTY CoBRA repository in this commit but can't find further documentation about where the code archive came from. Some web searching indicates the mpi.jar archive that is distributed with CRAFTY CoBRA is likely derived from the mpiJava package. In particular, src/Java/mpi/MPI.java within mpiJava refers to a library called savesignals. However I haven't been able to find the libsavesignals.so file that is referenced in the Makefiles within the mpiJava package source. I also haven't been able to successfully compile the package whose steps, I suppose, might generate libsavesignals.so.

Both ModelRunner.java and WorldLoader.java were modified by the CRAFTY CoBRA developert in 2020 to handle UnsatisfiedLinkErrors such as the one I have found (see commits 640136b and c8adffc). However the changes are mixed in with other changes that I fear will break CRAFTY Brazil.

Notes from efforts to compile mpiJava

It was necessary to link the file jni_md.h to the include directory of the java installation
/usr/lib/jvm/bellsoft-java8-full-amd64/include/linux/jni_md.h
ln -s /usr/lib/jvm/bellsoft-java8-full-amd64/include/linux/jni_md.h /usr/lib/jvm/bellsoft-java8-full-amd64/include/jni_md.h

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.