Solution of Nonlinear Least-Square Problems on a Multiprocessor Thomas F. Coleman1 Paul E Plassmann2 TR 88-923 June 1988 Department of Computer Science Cornell university Ithaca, NY 14853-7501 1 Research partially supported by the Applied Mathematical Sciences Research Program (KC-o4-o2) of the Office of Energy Research of the u.s Department of Energy under grant DE-FGo2-86ER25013.A 000. 2 Research partially supported by the Gomputational Mathematics Program of the National Science Foundation under grant DMS-8706133. Solution of Nonlinear Least-Squares Problems on a Multiprocessor Thomas F. Coleman1 Paul E. Plassmann2 Computer Science Department & Center for Applied Mathematics Cornell University Ithaca, New York 14853 June 1988 Abstract: In this paper we describe algorithms for solving nonlinear least-squares problems on a message-passing multiprocessor. We demonstrate new parallel algo- rithms, including an efficient parallel algorithm for determining the Levenberg- Marquardt parameter and a new row-oriented QR factorization algorithm. Experimen- tal results obtained on an Intel iPSC hypercube are presented and compared with sequential MINPACK code executed on a single processor. These experimental results show that essentially full efficiency is obtained for problems where the row size is sufficiently larger than the number of processors. These algorithms have the advantage of involving only simple data movements and consequently are not constrained to the hypercube architecture. Key Words: hypercube message-passing multiprocessor, algorithms computer, Levenberg-Marquardt, nonlinear least-squares, parallel algorithms, QR-factorization, trust-region Subject Classification: AMS/MOS: 65H10, 65F05, 65K05, 65K1O, 9OC3O Research partially supported by the Applied Mathematical Sciences Research Program (KC-04-02) of the office of Energy Research of the U.S. Department of Energy under grant DE-FGO2-86ER25013.AOOO. 2 Research partially supported by the Computational Mathematics program of the National Science Foundation under grant DMS-8706l33. 1. Introduction A common computational problem is the minimization of the function `v: R ? R where `v is the sum of squares of nonlinear functions. That is, `v can be expressed in terms of a func- tionF :R? ?R?, m>n, by the equation: `v(x) = `/2 II F(x) 1122 = `/2 ? (1.1) i=1 where f? is the I -th component of F. In this paper we will describe a parallel implementation of the Levenberg-Marquardt algorithin [M77] for solving these nonlinear least-squares prob- lems. The experimental results presented in this paper were obtained on a hypercube multipro- cessor but the algorithms themselves are more general. In fact, all that is required of multipro- cessor interconnection topology is support of a ring embedding and means for efficient gather and broadcast operations. Unlike in the parallel solution of systems of nonlinear equations [CL87, BSS88], low rank updates to the Jacobian approximation are usually not used in the small residual nonlinear least-squares setting [GMW8l]. Consequently, the dominant costs in these problems are the approximation of the Jacobian J (xk), where Xk is the k -th iterative approximation to the solu- tion, and the computation of the QR factorization of this approximation to J(Xk). The development of parallel algorithms for these two aspects of the problem, the approxi- mation and QR factorization of J, represents a dilemma when considering how to distribute the elements of the Jacobian onto the processors. This dilemma arises because the approximation of J by finite differences is most naturally approached by a column-oriented method and the QR factorization stage suggests a row-oriented solution. In a column-oriented algorithm for approximating the Jacobian the columns of J are partitioned into sets that assign computation of columns to processors by these sets. Assuming that F (Xk) is globally available, the j -th column of J can be approximated by computing F(x?+Tej), where ej is the j-th column of the identity matrix and T a constant, for each column I assigned to a processor. These computa- tions are entirely local and if n/p?l, where p is the number of processors, then the computa- tional load can be well-balanced by an even distribution of work to the processors. On the other hand, because we have that m >??, we expect a row-oriented approach, in which the rows of J are assigned to processors, to outperform a column-oriented method in the QR factoriza- tion stage. Using a row-oriented method in this case results in an algorithin whose efficiency -2- depends on the ratio mIp rather than n Ip. We have chosen to pursue a row-oriented algoritlim because experience has shown that computational costs involved in the QR factorization stage often dominate the Jacobian approx- imation stage. In addition, it is often the case that evaluation of the function F is separable. `mat is, if !? is the set of row indices assigned to processor i then the evaluation of F (x) can be effectively broken up into blocks, F?j(X ) = (fi (x) j E j?), where evaluation of each block is sufficienfly independent to allow for parallel evaluatio? The distribution of the rows of the Jacobian onto the processors determines the basic communication structure of the algorithins used in an implementation. We have chosen to use a ring embedding (e.g. a Gray code ordering of the nodes on a hypercube) and wrap the rows of the Jacobian onto this ring. Specifically, if the processors on the ring are numbered O,l,2;...,p-l then row k of the Jacobian would be assigned to processor (k--Hl)mod(p). Note, however, that components of F may be reordered to facilitate separability. This observation is especially applicable in the sparse setting where grouping rows with similar norizero structure on the same processor would help ensure separable evaluation. Such an assignment would also make sense for a sparse QR factorization since much progress in the triangular reduction of the system could be made by locally applied Givens rotations. The remainder of this paper is organized as follows. In section 2 we briefly review the relevant aspects of the Levenberg-Marquardt algorithm necessary to explain details of our algo- rithins. In section 3 we consider the problem of approximating the Jacobian and in section 4 we present a new row-oriented parallel QR factorization. Section 5 describes our parallel algo- rithin for determining the Levenberg-Marquardt parameter. Finally, we present experimental results and conclusions in section 6. -3- 2. Basics of the Levenberg-Marquardt Algorithm In this section we consider the essential aspects of the Levenberg-Marquardt algorithm relevant to a parallel perspective. For a more detailed description of the algorittirn we refer the interested reader to the excellent article by Mor? [M78]. As stated previously, the nonlinear least-squares problem is to minimize ?(x) as given in equation (1.1). Assuming that each f? E C2, then the gradient and Hessian of'j, are given by the expressions: = JTF (2.1) and v2'II=JTJ+?hv2L. , (2.2) i=1 where J is the Jacobian of F. When one expects the value of the ftmction to he small at the solution, known as small residual problems [MGW8 1 j, the Hessian can be approximated by jTj in a neighborbood of the solution. This approximation, which ignores the second term in the expression for the Hessian, represents a significant computational savings. Based on a quadratic model to the function `ir using the above Hessian approximation the Levenberg-Marquardt algorithin [M77, C84] solves a sequence of tmst-region problems of the form min ( iiJp +F 112 St. lIP 112 --Hp--Hl, then the Givens vector g is completely filled with updates that need to be applied once received. The order that these rotations are applied in the I loop is important. Since they operate on the same row of S, the rotations must be applied from oldest to newest. Also, note by row RAT we mean the nonz:ero components of row RAT that are local to processor i. These components are given by the index set Kj. Note that the difference in the average length of the messages sent between Algoritlims 5.1 and 5.2 translates into a much more efficient algorithni for the column-oriented approach. It is possible to decrease the length of the messages sent in the row-oriented method by postponing the application of the Givens rotations. Unfortunately, this algorithm is very complicated and was not implemented. The reduction of equation (2.7) to upper triangular form is the major task to be rendered parallel in an algoritlim for determining the Levenberg-Marquardt parameter X* and we have - 16 shown that there exist effective algorithins to perform this reduction. However, efficient solu- tion of triangular systems is also important in this context. In fact, for each iteration involving a solution of equation (2.7) there are two associated triangle solves that are used to bracket the solution ? [M78]. Experirnentally we used the triangle solve algorithms developed by Li and Coleman [LC87, LC88], but it should be noted that the efficiencies of these algorithms are not neafly as good as those of Algoritlirns 5.1 and 5.2. This difference is what accounts for the discrepancies between the efficiencies shown in Figure 5.1 and the efficiences reported in the next section for solving for the Levenberg-Marquardt parameter. This effect is apparent even though there is an 0(n) difference between the amount of work required for AIgorithm 5.1 and the corresponding triangular solves. The importance of efficient parallel triangle solvers has also been observed in the solution of systems of nonlinear equations [CL87]. - 17 - 6. Experimental Results and Conclusions These algoritlirns were implemented on a 16-node Intel iPSC/l hypercube with extended memory in RMfFoflran and run under version R3.l.l of the iPSC operating system. The efficiencies shown below were calculated by dividing the running time of MINPACK [MGH8O] code on a single processor by 16 times the running times of the algorithins described above on the hypercube. The comparison is fair as both programs generate the same sequence of iterates and consequently do the same number of Jacobian approximations, QR factorizations, and Newton iterations in computing the Levenberg-Marquardt parameten Problem F Eval. J Approx. F Eval. Function Form Characteristics Number Cost Cost Separable? A E R???, full rank, 1 F A x --He A x easily evaluated, 0(m) cheap no e an rn-vector of ones A E Rmxn, low rank, 2 F=Ax--He 0 (mn) expensive yes dense 3 fi =?Aq?XjX??l A sparse 0(m) cheap yes j,k fi =?(CXP(xjTi) Constrained, x <0 for 4 j 0 (nut) expensive yes ?eXP((?jTi)) (xO Table 6.1: Description of Test Functions The test problems used to obtain the experimental results are described in Table 6.1. Shown is the functional form of the test problems and the computational complexity of evaluat- ing each function is given in the column labeled "F Eval. Cost." We also make a subjective determination as to whether estimation of the Jacobian is cheap or expensive relative to its QR factorization. To be more specific about the functions used for testing, problem 1 has an 0(m) evaluation cost because of a special form for the matrix A: Ajj =--H2/m, i ?j; Ajj = 1 --H2/m. The matrix A used in problem 2 is of low rank: Aq = ii +0 (? perturbations, where e is the machine - 18 - precision. For problem 3 the tensor A has a bandwidth of 5 allowing for flinction evaluation with 0(m) cost The constants used for problem 4 were (xj = --Hj and Tj = jim In the final column of Table 6.1 we note whether we consider evaluation of these flinctions to be separ- able. Efficiencies Compared to MINPACK (% time spent in routine) Prob n m Total QR L-M R-S Tri. S. J Appr .644 .654 --- --- .089 .322 1 100 250 (100.0) (95.8) (0.0) (0.0) (1.2) (2.8) .801 .823 --- --- .089 .322 1 100 500 (100.0) (94.8) (0.0) (0.0) (1.4) (3.8) .679 .649 .527 .631 .084 .821 2 100 250 (100.0) (46.2) (23.7) (19.1) (4.6) (28.8) .784 .821 .510 .634 .093 .822 2 100 500 (100.0) (48.1) (15.2) (11.8) (2.8) (35.6) .813 .823 .758 .806 .175 .817 2 200 500 (100.0) (44.5) (19.2) (17.7) (1.2) (35.7) .798 .824 .547 .626 .098 .937 3 100 500 (100.0) (70.5) (14.2) (12.0) (2.2) (11.4) .814 .826 .759 .807 .175 .940 3 200 500 (100.0) (50.6) (39.6) (36.6) (2.5) (9.1) .824 .823 .756 .810 .179 .859 4 200 500 (100.0) (36.1) (25.0) (23.1) (1.6) (38.5) Table 6.2: Experimental Results of Parallel Algorithins Compared with MINPACK - 19 - Table 6.2 summerizes the experimental results obtained by comparing our parallel algo- rithlns with the MINPACK code running on a single processor for solving the test problems described in Table 6.1. The efficiences and the fraction of the total parallel running time spent in each of six sections of the programs are detailed. The six sections refer to: QR, the QR factorization of the Jacobian approximation; L-M, computation of the Levenberg-Marquardt parameter; R-S, the R-S reduction described in Section 5; Tri. 5., the solution of triangular sys- tems; and J Appr., the approximation of the Jacobian by forward differences. These results were choosen to illustrate an average case behavior of the parallel algo- rithins in solving nonlinear least-squares problems. For a particular problem the fraction of time spent in the different routines and the number of iterations required for convergence can vary dramatically for various choices of a starting point, initial trust-region size, and termina- tion tolerances. For the above problems the MINPACK tolerances were set to ?, where ? is the machine precision. The initial trust-region size was given by 10011 io 112 where i0 is the starting point normalized by the 2-norms of the columns of the initial Jacobian approximation. For problems 1, 2, and 3 an n-vector of ones was used as the starting point, and for problem 4 the starting point Xj = --H (I + 0.1) was employed. For the problem sizes shown in Table 6.2 problem 1 required respectively 3 and 4 iterations (Jacobian approximations) for convergence, problem 2 used 2, 3, and 3 iterations, and problem 3 required 6 and 14 iterations to converge. More than 50 iterations were required for problem 4 to converge; the results shown in Table 6.2 were taken from the first 10 iterations. From these results it is apparent that the QR factorization is the dominant computational cost for these problems. Consequently, the implementation is more efficient as m, the number of rows, increases. The cost of computing the Levenberg-Marquardt parameter can also be significant; this computation could dominate the QR factorization for problems that require a disproportionately large number of R-S reductions and for which the ratio min is close to one. This effect would occur in problems where the Jacobian is rank deficient or the function is very nonlinear (which would require a small trust-region in order to ensure an accurate qua- dratic model of the function). But again, for a fixed ratio min, the efficiency in solving for the Levenberg-Marquardt parameter increases as m increases. As expected the parallel triangular system solves are very inefficient when compared to the QR factorization and R-S reductions. However, the time required for these solves comprises only a small fraction of the total - 20 - computation time of the parallel implementation and therefore it does not significantly decrease the overall efficiency. For functions whose evaluation is very expensive we observe that the computation required for the approximation of the Jacobian by forward differences can equal or exceed the computation required for these other tasks. For the expensive test functions we considered the function evaluation was separable and hence the row-oriented Jacobian approximation algo- rithm yielded efficiencies comparable to the QR factorization and Levenherg-Marquardt param- eter solves. If the function evaluation were expensive and not separable one would have to resort to a column-oriented Jacobian approximation algorithm as described in Section 3. In this case the efficiency of the implementation would depend on the number of columns heing sufficiently large. Another possibility would be to obtain an algebraic expression for the Jaco- bian and evaluate the Jacobian directly rather than using forward differences; the algebraic evaluation of the Jacobian could be separable even when the function itself is noL In sum, we have observed good efficiencies when solving moderately sized nonlinear least-squares problems on the Intel hypercube. For the test problems considered we noted that the efficiency of our parallel implementation inipi?v?d as the ratio mip increased where m is the number of rows of Jacobian and p is the number of processors. We also point out that it is possible to solve much larger problems than those we have described above (which had to be run on one processor for comparison). The efficiencies for such larger problems would be correspondingly better. An additional topic for future consideration would be the solution of large sparse problems, especially problems that have special structure. For example, we note that a simple generalization of Algorithm 5.1 would work well if the Jacobian were banded and that the row-oriented approach to the QR factorization would be efficient in solving problems with a block structure. Acknowledgements The work that produced this paper was partially completed with the assistance of comput- ing facilities of the Advanced Computing Facility at the Cornell Center for Theory and Simula- tion in Science and Engineering, which is supported by the National Science Foundation and New York State. We would also like to acknowledge discussions at ORNL (as part of their Numerical Linear Algebra Year). - 21 References [BSS88] R. Byrd, R. Schnabel, and G. Shultz. Parallel Quasi-Newton Methods for Uncon- strained Optimization. Department of Computer Science, University of Colorado at Boulder, 1988. [CP86] Richard Chamherlain and M. J. D. Powell. QR Factorisation for Linear Least- Squares Problems on the Hypercube. Chr. Michelsen Institute, 1986. [C84J Thomas F. Coleman. Large Sparse Numerical Optimization. Springer-Verlag, 1984. [CL87] Thomas F. Coleman and Guangye Li. Solving Systems of Nonlinear Equations on a Message-Passing Multiprocessor. Tech. Rep. 87-887, Computer Science Depart- ment, Cornell University, 1987. [LC87] Guangye Li and Thomas F. Coleman. A New Method for Solving Triangular Sys- tems on Distributed Memory Message-Passing Multiprocessors. TR 87-812, Com- puter Science Department, Cornell University, 1987. [LC88j Guangye Li and Thomas F. Coleman. A Parallel Triangular Solver for a Distri- buted Memory Multiprocessor. SlAM J. Sci. Comput., 1988. [M87j C. Molen Matrix Computations on Distributed Memory Multiprocessors. Tech. Rep., Intel Scientific Computers, 1987. [MVV87] 0. M. McBryan and E. F. Van de Velde. Hypercube Algorithms and Implementa- tions. SlAM J. Sci. Comput., 1987. [GMW8l] Phillip Gill, Walter Murray, and Margaret Wright. Practical Optimization. Academic Press, 1981. [M77] Jorge J. Mor?. The Levenberg-Marquardt Algorithm: Implementation and Theory. Springer-Verlag, 1977. [MGH8O] Jorge J. Mor?, Burton Garbow, and Kenneth Hillstrom. User Guide for MINPACK-1. Argonne National Laboratory, 1980. [PR87] Alex Pothen and Padma Raghavan. Distributed Orthogonal Factorization.' Givens and Householder Algorithms. Department of Computer Science, The Pennsylvania State University, 1987.