defineTasks: Define a list of tasks for slave CPUs

Description Usage Arguments Author(s) Examples

Description

This function defines a list of PCIT tasks to be undertaken by slave CPUs in a parallel environment. The set of calculations performed for each trio of genes are entirely independent. Workload is distributed evenly among the slaves in order to maximise speed by assigning sets of gene trios to a task. The task is then carried out by a slave CPU. This assignment of gene trios into sets is based on which gene is in the first position in a given trio of genes. For example, if we have 5 genes (A, B, C, D and E) we have a set containing 6 gene trios with A in the first position (ABC, ABD, ABE, ACD, ACE and ADE), a set containing 3 gene trios with B in the first position (BCD, BCE and BDE) and a set containing 1 gene trio with C in the first position (CDE) giving a total of 10 gene trios (given by C(n,3), where n is the total number of genes) assigned to 1 of 3 sets. The computational workload for each trio is the same, thus the workload for a set of trios is directly proportional to the number of trios it contains, C(n-m,k-1), Where n is the total number of genes and the gene constrained in the first position of a gene trio is in the mth row/column in the correlation matrix and takes values in the interval [1,n-2].

By default, the number of tasks to be created is equal to the number for slave CPUs. Therefore, multiple gene trio sets are assigned to each task but in such a way as to balance the work load. Since gene trio sets created with small values of m have many more gene trio members than those created with larger values of m. A plot can be produced which shows the amount of work taken for a gene trio set constrained with the mth gene in the first position. The plot also shows how the cumlative work for all n-2 gene trio sets is divided into nSlave*tasksPerSlave equally sized tasks, so they can be completed in approximately the same amount of time.

Usage

1
	defineTasks(n, nSlaves, tasksPerSlave = 1, plot = FALSE)

Arguments

n

- The total number of genes.

nSlaves

- The number of slave CPUs.

tasksPerSlave

- The number of tasks to create for each slave CPU.

plot

- A boolean as to whether to generate a plot showing the total "work" to be carried out by each task.

Author(s)

Nathan S. Watson-Haigh

Examples

1
	defineTasks(n=100, nSlaves=5, plot=TRUE)

Example output

[[1]]
[[1]]$x
[1] 1 2 3 4 5 6 7


[[2]]
[[2]]$x
[1]  8  9 10 11 12 13 14 15


[[3]]
[[3]]$x
 [1] 16 17 18 19 20 21 22 23 24 25 26


[[4]]
[[4]]$x
 [1] 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41


[[5]]
[[5]]$x
 [1] 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
[26] 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
[51] 92 93 94 95 96 97 98

PCIT documentation built on May 1, 2019, 8:10 p.m.