{'fraction_non_alphanumeric': 0.03400353135501509, 'fraction_numerical': 0.010707979723187332, 'mean_word_length': 4.588160407383832, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Scaling Distributed All-Pairs Algorithms: Manage Computation and Limit Data Replication with Quorums

In this paper we propose and prove that cyclic quorum sets can efficiently manage all-pairs computations and data replication. The quorums are O(N/sqrt(P)) in size, up to 50% smaller than the dual N/sqrt(P) array implementations, and significantly smaller than solutions requiring all data. Implementation evaluation demonstrated scalability on real datasets with a 7x speed up on 8 nodes with 1/3rd the memory usage per process. The all-pairs problem requires all data elements to be paired with all other data elements. These all-pair problems occur in many science fields, which has led to their continued interest. Additionally, as datasets grow in size, new methods like these that can reduce memory footprints and distribute work equally across compute nodes will be demanded.


Introduction
In elementary schools and introductory computer science courses a popular "handshake" problem [1] is often taught and it goes something like this: people attend a party and a popular greeting is to shake hands, how many handshakes take place? After discussion and manipulation the answer of ( 2 ) = ( −1) 2 is derived.
This "handshake" problem is not reserved for the teaching introductory topics. In databases this manifests as a self-join without a join condition, forcing all tuples to interact with all other tuples. In physics, the n-body problem predicts the position and motion of bodies by calculating the total forces every body has on every other body. In biometrics applications, a similarity matrix can be formed using a set of images compared with itself using facial recognition [2]. In metagenomics, finding a protein's likeness to every other protein is a crucial part of forming the complex graphs used in protein clustering, which has led to new discoveries of protein functions [3].

Acceleration of Applications
Accelerating the execution of many of these important applications has been done using multicore CPUs, FPGAs, GPUs, Intel's many-core MIC, and distributed clusters. In [4] the authors provide a generalized framework to solve these all-pair classification of algorithms and show performance improvements for biometrics and data mining applications in a distributed system, e.g., cloud. A different approach was taken for a bioinformatics application seeking to reconstruct gene co-expression networks. The PCIT algorithm [5] was chosen to identify significant gene correlations. This method was optimized for Intel's multicore Xeon and many-core MIC [6]. Every element interacting with every other element leads to a natural result of having all elements present in memory. The generalized framework [4] showed that efficiently distributing all of the input data to all of the nodes prior to beginning execution resulted in faster turnaround times than reading from the disk on demand. The optimization of the PCIT algorithm [6] experienced needing all of the data in memory and created a second optimization strategy with longer runtimes, but had a minimal memory usage footprint.

Relaxing the All Elements Present Requirement
N-body problems have a natural all-pairs decomposition called atom-decomposition [7] that is based on equal distribution of element responsibilities to parallel processes.
To address load imbalances and the need to communicate all data to all processes, the authors proposed a method to perform force-decomposition which still requires input data replication, but reduced it to 2 arrays of size √ elements per process. The authors in [8] showed that data replication in the system can be variable ( ); and when = √ , a lower bound on communication is achieved. When = 1, their solution behaved similar to atom-decomposition, although requiring only 2 arrays of N/P elements per process. When = √ , their solution behaved similar to force-decomposition and still required 2 arrays of size √ elements per process.
Minimizing the amount of data replication in a distributed system, while maintaining efficient all-pairs algorithm operation, is a recurring theme in this classification of algorithms. Quorum systems are commonly used for coordination and mutual exclusion in distributed systems [9], [10]. Their decentralized approach and slow quorum growth rate compared to the system size are two of the reasons that make them a good tool in managing replicated data [11]. In 1985, quorums of size (√ ) were proven using finite projective planes [12]. Relaxed difference sets later were used to create size (√ ) cyclic quorum sets [10].

Scaling All-Pairs Algorithms
In this paper, we utilize the slow quorum growth rate compared to number of processes to scale the all-pairs classification of algorithms. We provide a proof that cyclic quorum sets have an all-pairs property that allows our solution to use a single array of size ( √ ) elements per process, significantly less than current solutions that have elements per process and up to 50% improvement over those that would require two arrays of size √ elements per process. These cyclic quorums are optimal for all Singer difference sets [13] and near-optimal for all others. For processes = 4, … ,111, our work uses the optimal cyclic quorums from [10]. The rest of the paper is organized as follows: Section 2 formalizes the all-pairs problem. Section 3 quorum sets, and more specifically cyclical quorum sets, are defined. Section 4 provides a definition of the all-pairs property and that cyclic quorums satisfy the property. Lastly, in Section 5 we experiment with a bioinformatics all-pairs application to show the scalability and memory efficiency of our all-pairs quorum methods.

All-Pairs Problem
The all-pairs problem (or "handshake" problem) occurs in many different fields and occurs in a broad classification of algorithms. On the surface the problem is very straight forward as shown in Figure 1. Given a set of data elements (seven in our example), an algorithm pairs all elements with all other elements. Notice that it is not necessary to explicitly form a ( 2 , 1 ) pair because the pair can be formed by the ( 1 , 2 ) pair already present.

Fig. 1.
All-pairs of seven data elements.

General All-Pairs Problem Definition
The pseudocode for a general all-pairs algorithm would look like the following: Stated more formally:

Distributed All-Pairs Problem Definition
The distributed all-pairs problem distributes the ( 2 ) element pairings across processes. The data elements are grouped into datasets: ⊆ , i ∈ 1, 2, … , P Equation 3 enumerates a set of datasets, one dataset per process. Equation 4 states that each dataset is equal to or a subset of the complete dataset and the union of those subsets equals the global dataset (Eq. 5). Methods of distributing the work and data vary, e.g., [4], [7], [8]. Some implementations give all of to all processes and each is responsible for a different portion of the the range of index is altered to allow for the pairing of with itself. This is unnecessary in Equation 2 because elements in general would not need to be paired with themselves; however once placed in a subset, it is still necessary that elements within a subset be paired with others within the same subset and not simply with only other subsets.
In the next section, we introduce the quorum sets that we use in our work to equally distribute work and data for the distributed all-pairs problem.

Quorum Sets
In distributed communication and algorithms, coordination, mutual exclusion, data replication and consensus implementations have grouped processes or nodes into sets called quorums [11]. This organization can minimize communications in operations like negotiating access to a global resource or reaching a joint, distributed decision. A quorum set minimally has the property that all quorums must intersect. Specifically for distributed implementations, it is also desirable that each quorum have equal work and equal responsibility within the quorum set. Not every grouping of nodes into sets (quorums) will result in having these three properties, nor will the quorum sizes be minimal. [12] proved the lower bound on the size of a quorum set with these three properties. Cyclic quorum sets have these properties and are proposed in this paper for efficient all-pairs problem computation and data replication management.

Defining Quorum Sets
From Equation 3, ̂ is set of datasets, one for each of the processes. Sets are subsets of ̂ (Eq. 7). When set of subsets (Eq. 8) covers all of ̂ (Eq. 9) and all subsets also have non-empty intersections (Eq. 10), then set is called a quorum set.
⊆̂, ∈ 1, 2, . . . , = { 1 , . . . , } ∩ ≠ ∅, ∀ , ∈ 1,2, . . . , The lower bounds for the maximum individual quorum size (i.e., | | ) in a minimum set is , where Equation 11 holds and ( − 1) is a power of a prime, proved through equivalence to finding a finite projective plane [12]. Additionally, it is desirable that each quorum in the quorum set be of equal size (Eq. 12), such that there is equal work and it is desirable that each dataset be contained in the same number of quorums (Eq. 13), such that there is equal responsibility.

Defining Cyclic Quorum Sets
Cyclic quorum sets are based on cyclic block design and cyclic difference sets, however searching for optimal sets requires an exhaustive search [10]. Cyclic quorum sets are unique in that once the first quorum (Eq. 14) is defined the remaining quorums in the set can be generated via incrementing the dataset indices (modulus to keep dataset indices within bounds is not shown in Equation 15 for conciseness). For simplicity, assume 1 ∈ 1 without loss of generality (any one-to-one re-mapping of dataset indices can result in this assumption).
For our work, we used the = 4, . . . ,111 optimal cyclic quorums from [10]. In the next section, we define and prove that cyclic quorum sets have an all-pairs property that makes them ideal for managing the distributed all-pairs problem.

All-Pairs Property for Quorum Sets
Cyclical quorums were introduced in the previous section as having a small size and equal work/responsibility properties. However, on the surface it is not apparent how these small/equable cyclic quorum sets can support the pairing of all { 1 , … , } distributed datasets to solve the general all-pairs problem (i.e., Section 2, Equation 6).
In this section we define the all-pairs property for quorum sets and provide a proof that cyclical quorum sets satisfy this property.

All-Pairs Property
As all-pairs algorithms scale using multiple processes and distribute the ( 2 ) work, it remains necessary that all pairs of elements are present in at least one process's memory. When using quorums in the distributed system, we assign each process a quorum of datasets. It is from there that we define the all-pairs property for quorums: Equation 16 states that for every pairing of datasets in D there exists at least one quorum in the quorum set that contains the pair. Quorum sets with this all-pairs property can be used to satisfy Equation 6 from Section 2, that defined all of the work that needed to be performed in the distributed all-pairs problem.

Cyclic Quorums have the All-Pairs Property
We use the relationship between cyclic quorum sets and difference sets [10] as part of a proof that the all-pairs property is satisfied.
Definition 1 defines a relaxed difference set as a set of integers whose values are greater than or equal 0 and less than . It has a restriction that every integer from 0 to ( − 1) must also be able to be formed from the difference of some pair of integers in the set (using modulus when necessary.) The intuition for Definition 2 relies on the quorum set's intersection property, ∩ ≠ ∅, ∀ , (Eq. 10). By contradiction, assume that set was not a relaxed difference set, then there would be value ≠ 0 that no difference ( − ), , ∈ equaled. Given that every quorum intersects in the set , there must be a shared item in 0 and . Equation 17 assumes the shared item is at indices and respectively, hence the shared item 0, and , are differenced on the lefthand side. Using the quorum set definition, the values for the items are substituted on the right side. Equation 18 uses the quorum intersection to simplify the left side to 0 before rebalancing to show that the assumption is false, hence set is a relaxed difference set. Proof by contradiction: Assume that the all-pairs property is not satisfied. Then there must a pair of integers ( , ), , ∈ 0, … , − 1 that are not present together in any quorum ∈ . Integers ( , ) have the following differences: Definition 2 states both differences in Equation 19 are formed at least once from the difference set = { 1 , … , }. Assume that integers ( , ), , ∈ form those specific differences: Using the cyclic quorum set definition and distributive property of modular arithmetic, Equation 21 shows all cyclic quorums can form the same differences. Using this result and that Equation 20 must produce the differences from Equation 19 otherwise Definition 2 would be false, we can now combine Equations 19-21.
Equations 22 and 23 are not necessarily both true at the same time, rather they enumerate the two values that the differences can take. ( − ) is not shown as it is just the inverse of the two equations shown. Equation 24 can be seen as combining all four into a single statement. All combinations of ( − ) differences can be expressed in terms of difference set and a corresponding quorum integer . This leads to our final result by distributing the modulus and separating the terms.
Equations 25 and 26 show that integers ( , ), , ∈ 0, … , − 1 are present together in a quorum defined by difference set and integer . This contradicts the assumption, hence cyclic quorum sets do satisfy the all-pair property.

Experimental Application Results
To evaluate the performance of our cyclic quorum set method, we modified an existing all-pairs application [6] to scale to larger datasets and at the same time be able to utilize more resources. The algorithm implemented the distributed all-pairs problem defined in Equation 6 using the cyclical quorum sets defined in Section 3.2.

PCIT Algorithm
The partial correlation coefficients combined with an information theory approach (PCIT) algorithm was introduced by [5]. The algorithm can be used for gene coexpression network reconstruction and help to identify novel biological regulators. The technique processes genes by building an ( 2 ) matrix and using a guilt-byassociation heuristic to analyze node pair partial correlations identifying whether a gene expression correlation is or is not meaningful.

Results
Testing was conducted using Cyence, an HPC machine at Iowa State University. Every node has dual 8-core processors and 128GB of memory. Two real and one synthetic input dataset were utilized with up to 20 execution runs per test. The single node PCIT algorithm from [6] was run with 16 OpenMP threads on a node by itself. The quorum implementations ran with one MPI process per processor (two per node) and 8 OpenMP threads per process. Figure 2 shows a 7x speed up in computation performance using 8 nodes as well as over 2/3 rd reduction of memory per process due to our cyclic quorum method for the all-pairs problem. On the left side of each graph is the single node optimized PCIT algorithm performance. For comparison, this single node performance is then divided by the number of additional nodes utilized by the quorum implementation and displayed in a decreasing curved line respective to each input file. As the number of nodes increase and the memory per process continues to decrease, the performance meets or exceeds the corresponding ideal lines. However, scaling only to two nodes encountered suboptimal and inconsistent performance as can be seen in the vertical bar extending above the curved ideal scaling line and the larger 95% confidence error bar that can be seen.

Fig. 2.
Performance and memory comparison between original single node algorithm and our cyclic quorum set implementation. Three inputs of different sizes were used. The figure on the left has the algorithm performance on the vertical bars and ideal scaling from one node to many illustrated with the curved horizontal lines. The figure on the right shows the memory requirement reduction per process as the application is scaled across more resources.

Conclusions
In this paper we proposed and proved that cyclic quorum sets are suitable for the allpairs problem, sometimes known as "handshake" problems. The dataset quorums are ( √ ) in size, up to 50% smaller than the dual √ array implementations, and significantly smaller than solutions requiring all data. Algorithm design can be simplified as all of the data needed for pairing exists in a process's dataset quorum. Implementation evaluation took a single node bioinformatics all-pairs implementation and demonstrated scalability on real datasets. Computation had a 7x speed up and memory usage per process was cut by 2/3 rd when using eight nodes.
Future work includes investigating optimization opportunities, particularly demonstrating the efficiency and power of utilizing Singer difference sets and achieving efficient performance even for non-Singer difference sets. The need for this work is motivated by the four process test that performed suboptimal in Figure 2. Lastly, for applications where redundancy is important, we are investigating using quorum redundancy to deliver memory and computationally efficient solutions.