Skip to content

cetusk/ScaLapack.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ScaLapack.jl

This file was created refering this repogitory: https://github.com/JuliaParallel/ScaLAPACK.jl. And supports Julia v.1.1.0.

Preparing for use MPI @ Mac OS X

$ brew install cmake
$ xcode-select --install
$ brew install gcc

Preparing for use ScaLapack.jl @ Mac OS X

$ brew install openmpi
$ brew install scalapack

Add package MPI

(v1.1) pkg> add MPI
(v1.1) pkg> build MPI

Add package ScaLapack

(v1.1) pkg> add https://github.com/Cetus-K/ScaLapack.jl.git

Execution: example

$ mpirun -np 4 --hostfile /path/to/hostfile /path/to/bin/of/julia /path/to/source.jl

If this "np" is more processes than your PC's physical core, you have to specify the option "--oversubscribe":

$ mpirun --oversubscribe -np 4 --hostfile /path/to/hostfile /path/to/bin/of/julia /path/to/source.jl

Usage: example for matrix multiplication

1. declare using ScaLapack.jl

using MPI
using ScaLapack
using ScaLapack: BLACS, ScaLapackLite

2. define parallelization parameters

const nrows_block = 2
const ncols_block = 2
const nprocrows = 2
const nproccols = 2

3. define matrices A and B

# T/nrows/ncols = user defined
if rank == 0
    A = Matrix{T}(undef, nrows, ncols)
    B = Matrix{T}(undef, nrows, ncols)
        for ia::Integer = 1 : nrows
        for ja::Integer = 1 : ncols
            A[ia, ja] = convert(Float64, ia+ja)
            B[ia, ja] = convert(Float64, ia*ja)
        end
    end
else
    A = Matrix{T}(undef, 0, 0)
    B = Matrix{T}(undef, 0, 0)
end
MPI.Barrier(comm)

4. prepare ScaLapackLiteParams and create ScaLapackLiteMatrix

params = ScaLapackLite.ScaLapackLiteParams(nrows_block, ncols_block, nprocrows, nproccols)
slm_A = ScaLapackLite.ScaLapackLiteMatrix(params, A)
slm_B = ScaLapackLite.ScaLapackLiteMatrix(params, B)

5. perform C = A * B^T and extract result

slm_C = slm_A * slm_B'
C = slm_C.X

About

Julia / ScaLapack interface

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages