{"id":27918764,"url":"https://github.com/juliaparallel/elemental.jl","last_synced_at":"2025-05-06T18:25:23.831Z","repository":{"id":29467677,"uuid":"33004231","full_name":"JuliaParallel/Elemental.jl","owner":"JuliaParallel","description":"Julia interface to the Elemental linear algebra library.","archived":false,"fork":false,"pushed_at":"2024-03-28T20:57:54.000Z","size":220,"stargazers_count":81,"open_issues_count":17,"forks_count":15,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-22T08:50:42.421Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JuliaParallel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2015-03-27T19:05:18.000Z","updated_at":"2025-04-14T10:33:41.000Z","dependencies_parsed_at":"2024-03-28T21:51:22.111Z","dependency_job_id":"8479fa2a-c9e3-4763-9334-9e5e736b5126","html_url":"https://github.com/JuliaParallel/Elemental.jl","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaParallel%2FElemental.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaParallel%2FElemental.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaParallel%2FElemental.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaParallel%2FElemental.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JuliaParallel","download_url":"https://codeload.github.com/JuliaParallel/Elemental.jl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252742656,"owners_count":21797287,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-06T18:25:22.999Z","updated_at":"2025-05-06T18:25:23.819Z","avatar_url":"https://github.com/JuliaParallel.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Elemental.jl\n\nA package for dense and sparse distributed linear algebra and optimization. The underlying functionality is provided by the C++ library [Elemental](https://github.com/LLNL/Elemental) written originally by [Jack Poulson](http://web.stanford.edu/~poulson/) and now maintained by LLNL.\n\n## Installation\nThe package is installed with `Pkg.add(\"Elemental\")`. For Julia versions 1.3 and later, Elemental uses the binaries provided by BinaryBuilder, which are linked against the MPI (mpich) provided through BinaryBuilder.\n\n## Examples\n\nEach of these examples should be run in a separate Julia session.\n\n### SVD example\n\nThis example runs on a single processor, and initializes MPI under the hood. However, explicit use of MPI.jl is not required in this case, compared to the other examples below.\n\n```jl\njulia\u003e using LinearAlgebra, Elemental\n\njulia\u003e A = Elemental.Matrix(Float64)\n0x0 Elemental.Matrix{Float64}\n\njulia\u003e Elemental.gaussian!(A, 100, 80);\n\njulia\u003e U, s, V = svd(A);\n\njulia\u003e convert(Matrix{Float64}, s)[1:10]\n10-element Array{Float64,1}:\n 19.8989\n 18.2702\n 17.3665\n 17.0475\n 16.4513\n 16.3197\n 16.0989\n 15.8353\n 15.5947\n 15.5079\n```\n\n### SVD example using MPI to parallelize on 4 processors\n\nIn this example, `@mpi_do` has to be used to send the parallel instructions to all processors.\n\n```jl\njulia\u003e using MPI, MPIClusterManagers, Distributed\n\njulia\u003e man = MPIManager(np = 4);\n\njulia\u003e addprocs(man);\n\njulia\u003e @everywhere using LinearAlgebra, Elemental\n\njulia\u003e @mpi_do man A = Elemental.DistMatrix(Float64);\n\njulia\u003e @mpi_do man Elemental.gaussian!(A, 1000, 800);\n\njulia\u003e @mpi_do man U, s, V = svd(A);\n\njulia\u003e @mpi_do man println(s[1])\n    From worker 5:  59.639990420817696\n    From worker 4:  59.639990420817696\n    From worker 2:  59.639990420817696\n    From worker 3:  59.639990420817696\n```\n\n### SVD example with DistributedArrays on 4 processors\n\nThis example is slightly different from the ones above in that it only calculates the singular values. However,\nit uses the DistributedArrays.jl package, and has a single thread of control. Note, we do not need to use `@mpi_do`\nexplicitly in this case.\n\n```jl\njulia\u003e using MPI, MPIClusterManagers, Distributed\n\njulia\u003e man = MPIManager(np = 4);\n\njulia\u003e addprocs(man);\n\njulia\u003e using DistributedArrays, Elemental\n\njulia\u003e A = drandn(1000, 800);\n\njulia\u003e Elemental.svdvals(A)[1:5]\n5-element SubArray{Float64,1,DistributedArrays.DArray{Float64,2,Array{Float64,2}},Tuple{UnitRange{Int64}},0}:\n 59.4649\n 59.1984\n 59.0309\n 58.7178\n 58.389\n```\n\n### Truncated SVD\nThe iterative SVD algorithm is implemented in pure Julia, but the factorized matrix as well as the Lanczos vectors are stored as distributed matrices in Elemental. Notice, that [`TSVD.jl`](https://github.com/JuliaLinearAlgebra/TSVD.jl) doesn't depend on Elemental and is only using `Elemental.jl` through generic function calls.\n\n```jl\njulia\u003e using MPI, MPIClusterManagers, Distributed\n\njulia\u003e man = MPIManager(np = 4);\n\njulia\u003e addprocs(man);\n\njulia\u003e @mpi_do man using Elemental, TSVD, Random\n\njulia\u003e @mpi_do man A = Elemental.DistMatrix(Float64);\n\njulia\u003e @mpi_do man Elemental.gaussian!(A, 5000, 2000);\n\njulia\u003e @mpi_do man Random.seed!(123) # to avoid different initial vectors on the workers\n\njulia\u003e @mpi_do man r = tsvd(A, 5);\n\njulia\u003e @mpi_do man println(r[2][1:5])\n    From worker 3:  [1069.6059089732858,115.44260091060129,115.08319164529792,114.87007788947226,114.48092348847719]\n    From worker 5:  [1069.6059089732858,115.44260091060129,115.08319164529792,114.87007788947226,114.48092348847719]\n    From worker 2:  [1069.6059089732858,115.44260091060129,115.08319164529792,114.87007788947226,114.48092348847719]\n    From worker 4:  [1069.6059089732858,115.44260091060129,115.08319164529792,114.87007788947226,114.48092348847719]\n```\n\n### Linear Regression\n\n```jl\n@mpi_do man A = Elemental.DistMatrix(Float32)\n@mpi_do man B = Elemental.DistMatrix(Float32)\n@mpi_do man copyto!(A, Float32[2 1; 1 2])\n@mpi_do man copyto!(B, Float32[4, 5])\n```\n\nRun distributed ridge regression ` ½|A*X-B|₂² + λ|X|₂²`\n\n```jl\n@mpi_do man X = Elemental.ridge(A, B, 0f0)\n```\n\nRun distributed lasso regression ` ½|A*X-B|₂² + λ|X|₁` (only supported in recent versions of Elemental)\n\n```jl\n@mpi_do man X = Elemental.bpdn(A, B, 0.1f0)\n```\n\n### Coverage\nRight now, the best way to see if a specific function is available, is to look through the source code. We are looking for help to prepare Documenter.jl based documentation for this package, and also to add more functionality from the Elemental library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliaparallel%2Felemental.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuliaparallel%2Felemental.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliaparallel%2Felemental.jl/lists"}