Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCG benchmark #177

Merged
merged 32 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a7845b7
reduced allocations for cg and mg preconditioner
HRvanElderen Jul 11, 2024
3888cf8
Mean and Max timing data added
HRvanElderen Jul 16, 2024
4aa886e
test added
HRvanElderen Jul 16, 2024
f4dab7d
comments added and tests
HRvanElderen Jul 17, 2024
9460852
test files and comments
HRvanElderen Jul 18, 2024
1e9718d
Merge branch 'fverdugo:master' into master
HRvanElderen Jul 22, 2024
313a340
minor type changes
HRvanElderen Jul 22, 2024
61d47d3
Merge branch 'master' of https://github.com/HRvanElderen/PartitionedA…
HRvanElderen Jul 22, 2024
596918d
type inference problems of preconditioner fixed
HRvanElderen Jul 24, 2024
c4a177f
JSON output added
HRvanElderen Jul 25, 2024
f7896df
pmatrix local values int32
HRvanElderen Jul 25, 2024
e0e1651
preconditioner fix additive schwarz
HRvanElderen Jul 30, 2024
e9c2211
Merge remote-tracking branch 'upstream/experimental'
HRvanElderen Jul 31, 2024
8220424
created zero guess gauss seidel sweep
HRvanElderen Aug 2, 2024
694aeaa
restructuring of setup phase
HRvanElderen Aug 28, 2024
d757739
richardson added back, optimised building matrix
HRvanElderen Sep 2, 2024
9d01455
Merge remote-tracking branch 'upstream/master'
HRvanElderen Sep 5, 2024
d01f678
converted to CSR to solve convergence error
HRvanElderen Sep 11, 2024
5b71e73
spmv csr test
HRvanElderen Sep 12, 2024
427b6ac
removed spmv split own and ghost
HRvanElderen Sep 12, 2024
ac430c9
split the algorithm in a base version and optimised version
HRvanElderen Sep 23, 2024
f72626d
hpcg clean-up and removal of changes to PartitionedArrays
HRvanElderen Oct 23, 2024
c8a9d0e
Merge remote-tracking branch 'upstream/master'
HRvanElderen Oct 23, 2024
44a5e95
removed polyester
HRvanElderen Oct 23, 2024
379119c
Reverted automated identation changes
HRvanElderen Oct 24, 2024
70b7766
revert files in PartitionedArrays
HRvanElderen Oct 24, 2024
f8942ff
revert auto indent changes smoother
HRvanElderen Oct 24, 2024
0ab5adb
converted all files to spaces
HRvanElderen Oct 24, 2024
c265d95
fixed smoother version
HRvanElderen Oct 24, 2024
23b0444
ci workflow cleanup
HRvanElderen Oct 24, 2024
d551b87
zero_guess_csc
HRvanElderen Oct 24, 2024
618c3e6
Added path to PartitionedSolvers to test env
HRvanElderen Oct 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 81 additions & 56 deletions .github/workflows/ci.yml
HRvanElderen marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,73 @@ on:
push:
branches:
- master
tags: '*'
tags: "*"
pull_request:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
test:
name: PartitionedArrays / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
# test:
# name: PartitionedArrays / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# version:
# - "1.6"
# - "1"
# os:
# - ubuntu-latest
# arch:
# - x64
# steps:
# - uses: actions/checkout@v2
# - uses: julia-actions/setup-julia@v1
# with:
# version: ${{ matrix.version }}
# arch: ${{ matrix.arch }}
# - uses: julia-actions/cache@v1
# - uses: julia-actions/julia-buildpkg@v1
# - uses: julia-actions/julia-runtest@v1
# - uses: julia-actions/julia-processcoverage@v1
# - uses: codecov/codecov-action@v2
# with:
# files: lcov.info
# PartitionedSolvers:
# name: PartitionedSolvers / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# version:
# - "1"
# os:
# - ubuntu-latest
# arch:
# - x64
# steps:
# - uses: actions/checkout@v2
# - uses: julia-actions/setup-julia@v1
# with:
# version: ${{ matrix.version }}
# arch: ${{ matrix.arch }}
# - uses: julia-actions/cache@v1
# - uses: julia-actions/julia-buildpkg@v1
# - run: |
# julia --project=PartitionedSolvers -e '
# using Pkg
# Pkg.develop(path=".")
# Pkg.test("PartitionedSolvers")'
HPCG:
name: HPCG / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.6'
- '1'
os:
- ubuntu-latest
arch:
- x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v2
with:
files: lcov.info
PartitionedSolvers:
name: PartitionedSolvers / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1'
- "1"
os:
- ubuntu-latest
arch:
Expand All @@ -58,31 +83,31 @@ jobs:
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
- run: |
julia --project=PartitionedSolvers -e '
julia --project=HPCG -e '
using Pkg
Pkg.develop(path=".")
Pkg.test("PartitionedSolvers")'
docs:
name: Documentation
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: '1'
- uses: julia-actions/julia-buildpkg@v1
- run: |
julia --project=docs -e '
using Pkg
Pkg.develop(path="PartitionedSolvers")'
- uses: julia-actions/julia-docdeploy@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
julia --project=docs -e '
using Documenter: DocMeta, doctest
using PartitionedArrays
DocMeta.setdocmeta!(PartitionedArrays, :DocTestSetup, :(using PartitionedArrays); recursive=true)
doctest(PartitionedArrays)'
Pkg.test("HPCG")'
# docs:
# name: Documentation
# runs-on: ubuntu-latest
# permissions:
# contents: write
# steps:
# - uses: actions/checkout@v2
# - uses: julia-actions/setup-julia@v1
# with:
# version: "1"
# - uses: julia-actions/julia-buildpkg@v1
# - run: |
# julia --project=docs -e '
# using Pkg
# Pkg.develop(path="PartitionedSolvers")'
# - uses: julia-actions/julia-docdeploy@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - run: |
# julia --project=docs -e '
# using Documenter: DocMeta, doctest
# using PartitionedArrays
# DocMeta.setdocmeta!(PartitionedArrays, :DocTestSetup, :(using PartitionedArrays); recursive=true)
# doctest(PartitionedArrays)'
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ Manifest.toml
docs/build/
tmp/
docs/src/examples.md

HPCG/src/results/

HPCG/results/
19 changes: 19 additions & 0 deletions HPCG/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name = "HPCG"
uuid = "f200b046-3a0e-49a8-9a9e-044aa3bf7874"
authors = ["Reinier van Elderen <[email protected]>"]
version = "0.1.0"

[deps]
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
PartitionedArrays = "5a9dfac6-5c52-46f7-8278-5e2210713be9"
PartitionedSolvers = "11b65f7f-80ac-401b-9ef2-3db765482d62"
Primes = "27ebfcd6-29c5-5fa9-bf4b-fb8fc14df3ae"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
SparseMatricesCSR = "a0a7dd2c-ebf4-11e9-1f05-cf50bc540ca1"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
32 changes: 32 additions & 0 deletions HPCG/src/HPCG.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module HPCG

using PartitionedArrays
using PartitionedSolvers
using LinearAlgebra
using DelimitedFiles
using Dates
using Statistics
using Primes
using DataStructures
using JSON
using SparseMatricesCSR
import Base: iterate

export hpcg_benchmark_mpi
export hpcg_benchmark_debug
export hpcg_benchmark
include("hpcg_benchmark.jl")

export build_matrix
export build_p_matrix
export ref_cg!
export pc_setup
export pc_solve!
include("hpcg_utils.jl")
include("compute_optimal_xyz.jl")
include("sparse_matrix.jl")
include("ref_cg.jl")
include("opt_cg.jl")
include("report_results.jl")
include("mg_preconditioner.jl")
end # module HPCG
64 changes: 64 additions & 0 deletions HPCG/src/compute_optimal_xyz.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
include("mixed_base_counter.jl")

"""
compute_optimal_shape_XYZ(np)

Calculate the optimal way to partition a 3D shape over np processors.
"""
function compute_optimal_shape_XYZ(np)

if np == 1
return 1, 1, 1
end

factors = Primes.factor(DataStructures.SortedDict, np)
primes = collect(keys(factors))
z = 0
x = primes[1]

if (length(primes) > 1)
y = primes[2]
end

if length(primes) == 1
z = x^(floor(Int, factors[x] / 3))
y = x^(floor(Int, factors[x] / 3 + ((factors[x] % 3) >= 2 ? 1 : 0)))
x = x^(floor(Int, factors[x] / 3 + ((factors[x] % 3) >= 1 ? 1 : 0)))
elseif length(primes) == 2 && factors[x] == 1 && factors[y] == 1 # two distinct prime factors
z = 1
elseif length(primes) == 2 && factors[x] + factors[y] == 3 # three prime factors one repeated
z = factors[x] == 2 ? x : y
elseif length(primes) == 3 && factors[x] == 1 && factors[y] == 1 && factors[primes[3]] == 1 # three distinct and single prime factors
z = primes[3]
else # 3 or more prime factors so try all possible 3-subsets

powers = collect(values(factors))
l, m, c = mixedbasecounter(powers, length(primes))
c_main = Mixed_base_counter(l, m, c)
c1 = Mixed_base_counter(l, m, c)

min_area = 2.0 * np + 1.0

c1 = next(c1)
while is_zero(c1)
c2 = mixedbasecounter1(c_main, c1)
c2 = next(c2)
while is_zero(c2)
tf1 = product(c1, primes)
tf2 = product(c2, primes)
tf3 = np / tf1 / tf2 # we derive the third dimension, we don't keep track of the factors it has

area = tf1 * tf2 + tf2 * tf3 + tf1 * tf3
if (area < min_area)
min_area = area
x = tf1
y = tf2
z = tf3
end
c2 = next(c2)
end
c1 = next(c1)
end
end
return x, y, floor(Int, z)
end
Loading
Loading