@@ -1357,177 +1357,6 @@ function psparse_assemble_impl(A,::Type,rows)
13571357 error (" Case not implemented yet" )
13581358end
13591359
1360- # function psparse_assemble_impl(
1361- # A,
1362- # ::Type{<:AbstractSplitMatrix},
1363- # rows;
1364- # reuse=Val(false),
1365- # assembly_neighbors_options_cols=(;))
1366-
1367- # function setup_cache_snd(A,parts_snd,rows_sa,cols_sa)
1368- # A_ghost_own = A.blocks.ghost_own
1369- # A_ghost_ghost = A.blocks.ghost_ghost
1370- # gen = ( owner=>i for (i,owner) in enumerate(parts_snd) )
1371- # owner_to_p = Dict(gen)
1372- # ptrs = zeros(Int32,length(parts_snd)+1)
1373- # ghost_to_owner_row = ghost_to_owner(rows_sa)
1374- # ghost_to_global_row = ghost_to_global(rows_sa)
1375- # own_to_global_col = own_to_global(cols_sa)
1376- # ghost_to_global_col = ghost_to_global(cols_sa)
1377- # for (i,_,_) in nziterator(A_ghost_own)
1378- # owner = ghost_to_owner_row[i]
1379- # ptrs[owner_to_p[owner]+1] += 1
1380- # end
1381- # for (i,_,_) in nziterator(A_ghost_ghost)
1382- # owner = ghost_to_owner_row[i]
1383- # ptrs[owner_to_p[owner]+1] += 1
1384- # end
1385- # length_to_ptrs!(ptrs)
1386- # Tv = eltype(A_ghost_own)
1387- # ndata = ptrs[end]-1
1388- # I_snd_data = zeros(Int,ndata)
1389- # J_snd_data = zeros(Int,ndata)
1390- # V_snd_data = zeros(Tv,ndata)
1391- # k_snd_data = zeros(Int32,ndata)
1392- # nnz_ghost_own = 0
1393- # for (k,(i,j,v)) in enumerate(nziterator(A_ghost_own))
1394- # owner = ghost_to_owner_row[i]
1395- # p = ptrs[owner_to_p[owner]]
1396- # I_snd_data[p] = ghost_to_global_row[i]
1397- # J_snd_data[p] = own_to_global_col[j]
1398- # V_snd_data[p] = v
1399- # k_snd_data[p] = k
1400- # ptrs[owner_to_p[owner]] += 1
1401- # nnz_ghost_own += 1
1402- # end
1403- # for (k,(i,j,v)) in enumerate(nziterator(A_ghost_ghost))
1404- # owner = ghost_to_owner_row[i]
1405- # p = ptrs[owner_to_p[owner]]
1406- # I_snd_data[p] = ghost_to_global_row[i]
1407- # J_snd_data[p] = ghost_to_global_col[j]
1408- # V_snd_data[p] = v
1409- # k_snd_data[p] = k+nnz_ghost_own
1410- # ptrs[owner_to_p[owner]] += 1
1411- # end
1412- # rewind_ptrs!(ptrs)
1413- # I_snd = JaggedArray(I_snd_data,ptrs)
1414- # J_snd = JaggedArray(J_snd_data,ptrs)
1415- # V_snd = JaggedArray(V_snd_data,ptrs)
1416- # k_snd = JaggedArray(k_snd_data,ptrs)
1417- # (;I_snd,J_snd,V_snd,k_snd,parts_snd)
1418- # end
1419- # function setup_cache_rcv(I_rcv,J_rcv,V_rcv,parts_rcv)
1420- # k_rcv_data = zeros(Int32,length(I_rcv.data))
1421- # k_rcv = JaggedArray(k_rcv_data,I_rcv.ptrs)
1422- # (;I_rcv,J_rcv,V_rcv,k_rcv,parts_rcv)
1423- # end
1424- # function setup_own_triplets(A,cache_rcv,rows_sa,cols_sa)
1425- # nz_own_own = findnz(A.blocks.own_own)
1426- # nz_own_ghost = findnz(A.blocks.own_ghost)
1427- # I_rcv_data = cache_rcv.I_rcv.data
1428- # J_rcv_data = cache_rcv.J_rcv.data
1429- # V_rcv_data = cache_rcv.V_rcv.data
1430- # k_rcv_data = cache_rcv.k_rcv.data
1431- # global_to_own_col = global_to_own(cols_sa)
1432- # is_ghost = findall(j->global_to_own_col[j]==0,J_rcv_data)
1433- # is_own = findall(j->global_to_own_col[j]!=0,J_rcv_data)
1434- # I_rcv_own = view(I_rcv_data,is_own)
1435- # J_rcv_own = view(J_rcv_data,is_own)
1436- # V_rcv_own = view(V_rcv_data,is_own)
1437- # k_rcv_own = view(k_rcv_data,is_own)
1438- # I_rcv_ghost = view(I_rcv_data,is_ghost)
1439- # J_rcv_ghost = view(J_rcv_data,is_ghost)
1440- # V_rcv_ghost = view(V_rcv_data,is_ghost)
1441- # k_rcv_ghost = view(k_rcv_data,is_ghost)
1442- # # After this col ids in own_ghost triplet remain global
1443- # map_global_to_own!(I_rcv_own,rows_sa)
1444- # map_global_to_own!(J_rcv_own,cols_sa)
1445- # map_global_to_own!(I_rcv_ghost,rows_sa)
1446- # map_ghost_to_global!(nz_own_ghost[2],cols_sa)
1447- # own_own_I = vcat(nz_own_own[1],I_rcv_own)
1448- # own_own_J = vcat(nz_own_own[2],J_rcv_own)
1449- # own_own_V = vcat(nz_own_own[3],V_rcv_own)
1450- # own_own_triplet = (own_own_I,own_own_J,own_own_V)
1451- # own_ghost_I = vcat(nz_own_ghost[1],I_rcv_ghost)
1452- # own_ghost_J = vcat(nz_own_ghost[2],J_rcv_ghost)
1453- # own_ghost_V = vcat(nz_own_ghost[3],V_rcv_ghost)
1454- # map_global_to_ghost!(nz_own_ghost[2],cols_sa)
1455- # own_ghost_triplet = (own_ghost_I,own_ghost_J,own_ghost_V)
1456- # triplets = (own_own_triplet,own_ghost_triplet)
1457- # aux = (I_rcv_own,J_rcv_own,k_rcv_own,I_rcv_ghost,J_rcv_ghost,k_rcv_ghost,nz_own_own,nz_own_ghost)
1458- # triplets, own_ghost_J, aux
1459- # end
1460- # function finalize_values(A,rows_fa,cols_fa,cache_snd,cache_rcv,triplets,aux)
1461- # (own_own_triplet,own_ghost_triplet) = triplets
1462- # (I_rcv_own,J_rcv_own,k_rcv_own,I_rcv_ghost,J_rcv_ghost,k_rcv_ghost,nz_own_own,nz_own_ghost) = aux
1463- # map_global_to_ghost!(own_ghost_triplet[2],cols_fa)
1464- # map_global_to_ghost!(J_rcv_ghost,cols_fa)
1465- # TA = typeof(A.blocks.own_own)
1466- # n_own_rows = own_length(rows_fa)
1467- # n_own_cols = own_length(cols_fa)
1468- # n_ghost_rows = ghost_length(rows_fa)
1469- # n_ghost_cols = ghost_length(cols_fa)
1470- # Ti = indextype(A.blocks.own_own)
1471- # Tv = eltype(A.blocks.own_own)
1472- # own_own = compresscoo(TA,own_own_triplet...,n_own_rows,n_own_cols)
1473- # own_ghost = compresscoo(TA,own_ghost_triplet...,n_own_rows,n_ghost_cols)
1474- # ghost_own = compresscoo(TA,Ti[],Ti[],Tv[],n_ghost_rows,n_own_cols)
1475- # ghost_ghost = compresscoo(TA,Ti[],Ti[],Tv[],n_ghost_rows,n_ghost_cols)
1476- # blocks = split_matrix_blocks(own_own,own_ghost,ghost_own,ghost_ghost)
1477- # values = split_matrix(blocks,local_permutation(rows_fa),local_permutation(cols_fa))
1478- # nnz_own_own = nnz(own_own)
1479- # k_own_sa = precompute_nzindex(own_own,own_own_triplet[1:2]...)
1480- # k_ghost_sa = precompute_nzindex(own_ghost,own_ghost_triplet[1:2]...)
1481- # for p in 1:length(I_rcv_own)
1482- # i = I_rcv_own[p]
1483- # j = J_rcv_own[p]
1484- # k_rcv_own[p] = nzindex(own_own,i,j)
1485- # end
1486- # for p in 1:length(I_rcv_ghost)
1487- # i = I_rcv_ghost[p]
1488- # j = J_rcv_ghost[p]
1489- # k_rcv_ghost[p] = nzindex(own_ghost,i,j) + nnz_own_own
1490- # end
1491- # cache = (;k_own_sa,k_ghost_sa,cache_snd...,cache_rcv...)
1492- # values, cache
1493- # end
1494- # rows_sa = partition(axes(A,1))
1495- # cols_sa = partition(axes(A,2))
1496- # #rows = map(remove_ghost,rows_sa)
1497- # cols = map(remove_ghost,cols_sa)
1498- # parts_snd, parts_rcv = assembly_neighbors(rows_sa)
1499- # cache_snd = map(setup_cache_snd,partition(A),parts_snd,rows_sa,cols_sa)
1500- # I_snd = map(i->i.I_snd,cache_snd)
1501- # J_snd = map(i->i.J_snd,cache_snd)
1502- # V_snd = map(i->i.V_snd,cache_snd)
1503- # graph = ExchangeGraph(parts_snd,parts_rcv)
1504- # t_I = exchange(I_snd,graph)
1505- # t_J = exchange(J_snd,graph)
1506- # t_V = exchange(V_snd,graph)
1507- # @fake_async begin
1508- # I_rcv = fetch(t_I)
1509- # J_rcv = fetch(t_J)
1510- # V_rcv = fetch(t_V)
1511- # cache_rcv = map(setup_cache_rcv,I_rcv,J_rcv,V_rcv,parts_rcv)
1512- # triplets,J,aux = map(setup_own_triplets,partition(A),cache_rcv,rows_sa,cols_sa) |> tuple_of_arrays
1513- # J_owner = find_owner(cols_sa,J)
1514- # rows_fa = rows
1515- # cols_fa = map(union_ghost,cols,J,J_owner)
1516- # assembly_neighbors(cols_fa;assembly_neighbors_options_cols...)
1517- # vals_fa, cache = map(finalize_values,partition(A),rows_fa,cols_fa,cache_snd,cache_rcv,triplets,aux) |> tuple_of_arrays
1518- # assembled = true
1519- # B = PSparseMatrix(vals_fa,rows_fa,cols_fa,assembled)
1520- # if val_parameter(reuse) == false
1521- # B
1522- # else
1523- # B, cache
1524- # end
1525- # end
1526- # end
1527-
1528- # New assemble
1529- # ###################
1530-
15311360function psparse_assemble_impl (A:: PSparseMatrix{V,B,C,D,Tv} where {V,B,C,D},
15321361 :: Type{T} ,
15331362 rows;
0 commit comments