4

Julia is now supported on IBM Power

 2 years ago
source link: https://developer.ibm.com/blogs/julia-supported-on-power/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Blog Post

Julia is now supported on IBM Power

Explore the benefits of using Julia on IBM Power and learn how to give it a try


Julia is a general-purpose programming language with a special focus on scientific computing. Julia is as fast as C programming language in many cases while remaining dynamic like Python.

We are happy to announce that as of Dec 19, 2021, Julia 1.6.2 is supported on the IBM Power platform, “Tier-3” level. For more information about Tier 3, refer to the Julia download page.

The popularity of Julia has been soaring since it first became available in 2012, and it is currently in the top 30 programming languages as per the TIOBE index.

Refer to the following interesting articles about Julia:

Benefits of Julia on IBM Power

Designed with machine learning (ML) in mind, Julia focuses on the scientific computing domain and its need for parallel, distributed, and intensive computation tasks. Juliahas a powerful suite of libraries for developing artificial intelligence which includes general linear models, decision trees, clustering, Flux for deep learning, text analysis for natural language processing, and so on. Julia benefits to Power in the following ways:

  • Julia is an easy programming language to learn. Its syntax is similar to Python and MATLAB, and can be easily adapted on Power. The following code snippet shows the similarity among Julia, MATLAB, and Python languages:

    Description MATLAB syntax Python syntax Julia syntax

    Import packages Nil import numpy as np
    import matpotlib.pyplot as plt Import Pkg
    Pkg.add(“Plots”)
    using Plots

    Define the variable for X axis x = 0 : pi/10 : 2pi; x=np.linespace(0, 2np.pi, 21) x = 0 : pi/10 : 2*pi;

    Define the variable for Y axis y = sin(x); y = np.sin(x) y = sin.(x);

    Code snippet to plot the graph plot(x,y)
    title(‘My first plot’)
    xlabel(‘x-axis’)
    ylabel(‘y-axis’)

    plt.plot(x,y)
    plt.title(‘My first plot’)
    plt.xlabel(‘x-axis’)
    ply.ylabel(‘y-axis)

    plot(x,y
    title=”My first plot”,
    xaxis=(“x-axis”),
    yaxis=(“y-axis”))

  • Julia integrates well with the existing code and platforms such as IBM Power.

  • Julia combines the familiarity and ease of use of Python and R with the speed and the strength of C, C++, or Java. So programmers no longer need to estimate models in one language and reproduce them in a faster production language.

Check out Why Data Scientists Are Falling in Love With Julia.

What did we do and how did it work?

  • The first time we tried to build Julia on IBM Power, it failed due to errors. Later, we were able to trace back to low level virtual machine (LLVM) and those were fixed in the subsequent LLVM releases [pull request (PR) for LLVM release fixes].
  • We encountered some issues related to code generation, which were traced and corrected by the LLVM team.
  • Cbc and JuMP libraries did not work with Julia due to interfaces that were not updated for Power. This has been fixed (PR for Cbc and JuMP fixes).
  • We added support for detecting the correct CPU ID that was implemented in the upstream code (PR for detecting correct CPU ID).
  • There are miscellaneous fixes for Power in Julia.

Try Julia on Power

Perform the following steps to install and run Julia on a Power virtual machine (VM):

  1. Download the latest stable build of Julia. Enter the following command on the Power system to get the TAR file for Power (ppc64le):

    wget https://julialang-s3.julialang.org/bin/linux/ppc64le/1.6/julia-1.6.2-linux-ppc64le.tar.gz
    
  2. Extract the .tar file.

    tar -xvzf julia-1.6.2-linux-ppc64le.tar.gz
    
  3. Enter the following commands to run the Julia binary file present in the bin/julia directory of the extracted directory:

    [user1@p006vm71 ~]$ cd julia-1.6.2
    [user1@p006vm71 julia-1.6.2]$ bin/julia
    
    [user1@p006vm71 julia-1.6.2]$ export PATH=$PATH:~/julia-1.6.2/bin
    [user1@p006vm71 julia-1.6.2]$ julia
    

The command prompt of the Julia console looks as follows:

img1

How can you use Julia?

Julia can be used to run scripts and many other commands that can provide simple to complex output. Following are some of the examples:

  • Use the following Julia command to find the platform and version information:

    julia>
    julia> versioninfo()
    Julia Version 1.8.0-DEV.889
    Commit f14e44f38b* (2021-11-03 05:54 UTC)
    Platform Info:
    OS: Linux (ppc64le-redhat-linux)
    CPU: POWER8 (architected), altivec supported
    WORD_SIZE: 64
    LIBM: libopenlibm
    LLVM: libLLVM-12.0.1 (ORCJIT, pwr8)
    
  • Run the following Julia code snippet to find the CPU information:

    julia> ccall(:jl_dump_host_cpu, Cvoid, ())
    CPU: pwr8
    Features:
    julia>
    
  • Run a .jl file to get the required output. Following are the steps to run a sample .jl file:

    1. Write the following code in Julia (that plots a graph on the X and Y axis) and save it as plots.jl:

      import Pkg
      Pkg.add("Plots")
      
      using Plots
      
      # plot some data
      plot([cumsum(rand(500) .- 0.5), cumsum(rand(500) .- 0.5)])
      
      # save the current figure
      savefig("plots.svg")
      
    2. Run plots.jl as:

      julia plots.jl
      

      The output is as follows:

      img2

For more information about working with Julia, visit https://docs.julialang.org/

Acknowledgment

The authors would like to thank Valentin Churavy, Nemanja Klimnovic, and Hari Reddy for helping them to get Julia running on Power.

Reference articles


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK