Parallel Hybrid PSO with CUDA for Ld Heat Conduction Equation
Total Page:16
File Type:pdf, Size:1020Kb
Computers & Fluids 110 (2015) 198–210 Contents lists available at ScienceDirect Computers & Fluids journal homepage: www.elsevier.com/locate/compfluid Parallel hybrid PSO with CUDA for lD heat conduction equation ⇑ Aijia Ouyang a, Zhuo Tang a, , Xu Zhou a, Yuming Xu a, Guo Pan a, Keqin Li a,b a College of Information Science and Engineering, Hunan University, Changsha, Hunan 410082, China b Department of Computer Science, State University of New York at New Paltz, New Paltz, NY 12561, USA article info abstract Article history: Objectives: We propose a parallel hybrid particle swarm optimization (PHPSO) algorithm to reduce the Received 8 December 2013 computation cost because solving the one-dimensional (1D) heat conduction equation requires large Received in revised form 6 May 2014 computational cost which imposes a great challenge to both common hardware and software Accepted 15 May 2014 equipments. Available online 28 May 2014 Background: Over the past few years, GPUs have quickly emerged as inexpensive parallel processors due to their high computation power and low price, The CUDA library can be used by Fortran, C, C++, Keywords: and by other languages and it is easily programmed. Using GPU and CUDA can efficiently reduce the com- Heat conduction equation putation time of solving heat conduction equation. Spline difference method Particle swarm optimization Methods: Firstly, a spline difference method is used to discrete 1D heat conduction equation into the Conjugate gradient method form of linear equation systems, secondly, the system of linear equations is transformed into an uncon- GPU strained optimization problem, finally, it is solved by using the PHPSO algorithm. The PHPSO is based on CUDA by hybridizing the PSO and conjugate gradient method (CGM). Results: A numerical case is given to illustrate the effectiveness and efficiency of our proposed method. Comparison of three parallel algorithms shows that the PHPSO is competitive in terms of speedup and standard deviation. The results also show that using PHPSO to solve the one-dimensional heat conduction equation can outperform two parallel algorithms as well as HPSO itself. Conclusions: It is concluded that the PHPSO is an efficient and effective approach towards the 1D heat conduction equation, as it is shown to be with strong robustness and high speedup. Ó 2014 Elsevier Ltd. All rights reserved. 1. Introduction simulations [5], volume visualization [6], hopfield neural network [7], particle filters [8], robotic map [9], finite difference schemes Recently, taking advantage of graphic processing capability, [10,11], object recognition [12], thermal analysis [13], hydrody- numerical simulation has become available via the utilization of namic simulations [14], thermodynamic systems [15], solidifica- a GPU (graphics processing unit) instead of a CPU (central process- tion process simulation [16], computational fluid dynamics ing unit) [1]. In its initial stage, however, the GPU cannot be made [17,18], particle simulation [19,20]. to communicate with an API (application programming interface) The one-dimensional heat conduction equation is a well- such as OpenGL and DirectX. In November 2006, NVIDIA unveiled known simple second order linear partial differential equation the industry’s first DirectX 10 GPU, the GeForce 8800 GTX. The (PDE) [21–24]. PDEs like the heat conduction equation often arise GeForce 8800 GTX was also the first GPU to be built with NVIDIAs in modeling problems in science and engineering. It is also used CUDA (compute unified device architecture). Over the past few in financial mathematics in the modeling of options. For years, graphics processing units (GPUs) have quickly emerged as example, the Black–Scholes option pricing model’s differential inexpensive parallel processors due to their high computation equation can be transformed into the heat conduction equation power and low price [2,3]. The CUDA library can be used by For- [25,26]. tran, C, C++, and by other languages and it is easily programmed. Over the last few years, many physical phenomena were formu- Graphics processing units (GPU) technique has been applied to lated into nonlocal mathematical model. These physical phenom- large-scale social networks [4], smoothed particle hydrodynamics ena are modeled by nonclassical parabolic initial-boundary value problems in one space variable which involve an integral term over the spatial domain of a function of desired solution. This integral ⇑ Corresponding author. term may appear in a boundary condition, which is called nonlocal, E-mail address: [email protected] (Z. Tang). or in the governing partial differential equation itself, which is http://dx.doi.org/10.1016/j.compfluid.2014.05.020 0045-7930/Ó 2014 Elsevier Ltd. All rights reserved. A. Ouyang et al. / Computers & Fluids 110 (2015) 198–210 199 often referred to as a partial integro-differential equation, or in @u @2u ¼ a ; 0 < x < 1; 0 < t 6 T; ð1Þ both [27]. @t @x2 The presence of an integral term in a boundary condition can with initial conditions greatly complicate the application of standard numerical tech- niques such as finite difference procedures, finite element methods, uðx; 0Þ¼f ðxÞ; 0 6 x 6 1; ð2Þ spectral techniques, and boundary integral equation schemes. @u uð1; tÞ¼gðtÞ; 0 < t 6 T; ð3Þ Therefore, it is essential that nonlocal boundary value problems @x can be converted a more desirable form and to make them more applicable to problems of practical interest. and a nonlocal condition R Recently, nonlocal boundary value problems have been covered b uðx; tÞdx ¼ mðtÞ; in the literature [28–31]. For instance, Dehghan [32] presented a 0 ð4Þ 0 < t 6 T; 0 < b < 1: new finite difference technique for solving the one-dimensional heat conduction equation subject to the specification of mass, In this problem, f ðxÞ; gðtÞ and mðtÞ are given functions and a but their methods are only first-order accurate. Caglar et al. [33] and b are constants. If b ¼ 1, Eq. (4) can be differentiated as Z Z developed a third degree B-spines method to solve the heat 1 1 2 2 0 conduction Eqs. (1)–(3) with the accuracy of Oðk þ h Þ, and at m ðtÞ¼ utdx ¼ auxxdx ¼ auxð1; tÞauxð0; tÞ: ð5Þ the endpoints, the approximation order is second order only. Liu 0 0 et al. [34] used a quartic spline method to solve one-dimensional The derivation holds only when m and u are differentiable. telegraphic equations, we consider the lD heat conduction equa- tion in accordance with the above method. Tsourkas and Rubinsky 2.2. Quartic spline and interpolation error used a parallel genetic algorithm for solving heat conduction prob- lems [35,36]. Let P be a uniform partition of ½0; 1 as follows It is well-known that genetic algorithm is a classic evolution- 0 ¼ x0 < x1 < ÁÁÁ< xn ¼ 1; ð6Þ ary algorithm.It has been successfully applied to all kinds of real problems, such asoptimizing system state in a cloud system where xi ¼ ih; h ¼ 1=n. [37]. PSO is also an evolutionary algorithm and it is developed The quartic spline space on ½0; 1 is defined as no by Dr.Eberhart and Dr. Kennedy in 1995, inspired by social behav- 3 3 S ðPÞ¼ s 2 C ½0; 1 : sj 2 P4; i ¼ 1ð1Þn ; ior ofbird flocking or fish schooling. PSO has an outstandingperfor- 4 ½xiÀ1;xi mance in optimizing functions. Integrating the successful methods where P is the set of polynomials of degree at most d. and efficient hybrid strategies, we present a PHPSO algorithm d It is easy to know that dim S3ðPÞ¼n þ 4. For any s 2 S3ðPÞ, the based on CUDA for the one-dimensional heat conduction equa- 4 4 restriction of s in ½x ; x can be expressed as tion. This paper has some contributions, which are described as iÀ1 i follows. t2 t4 t3 sðxÞ¼s þ hs0 t þ h2s00 ð6 À t2Þþh2s00 þ h3s000 ð2 À tÞ; iÀ1 iÀ1 iÀ1 12 i 12 iÀ1 12 1. A new method for solving the one-dimensional heat conduction ð7Þ equation with the nonlocal boundary value conditions is con- where x x th, t 0; 1 , s s x ; s0 s0 x , s00 s00 x ; structed by using quartic spline functions. It shows that the ¼ iÀ1 þ 2½ i ¼ ð iÞ i ¼ ð iÞ i ¼ ð iÞ 2 4 s000 s000 x ; i 0 1 n. accuracy of the presented method can reach Oðk þ h Þ at the i ¼ ð iÞ ¼ ð Þ interior nodal points. This leads to 2. We also obtain a new method to deal with the nonlocal bound- 0 5 2 00 1 2 00 1 3 000 4 s ¼ s þ hs þ h s þ h s þ h s ; ð8Þ ary conditions with the accuracy being Oðk þ h Þ. It is much bet- i iÀ1 iÀ1 12 iÀ1 12 i 12 iÀ1 ter than the classical finite difference method with the accuracy 2 of Oðk þ h Þ. 2 00 1 00 1 2 s0 ¼ s0 þ hs þ hs þ h s000 ; ð9Þ 3. We design a parallel hybrid algorithm by hybridizing the PSO i iÀ1 3 iÀ1 3 i 6 iÀ1 and CGM with the CUDA technique. Such an algorithm can 2 ÂÃ s000 ¼s000 þ s00 À s00 ; ð10Þ speed up the convergence to the optimum solution. i iÀ1 h i iÀ1 for i ¼ 1ð1Þn. Based on the above three equations, we can have The remainder of this paper is organized in the following way. Section 2 gives a detailed theoretical analysis and mathematical 1 00 5 00 1 00 1 siþ1 þ si þ siÀ1 ¼ 2 ½siþ1 À 2si þ siÀ1; i ¼ 1ð1Þn À 1: ð11Þ proof concerning the 1D heat conduction equation. Section 3 12 6 12 h shows the process of transforming a system linear systems into Likewise, if we write the quartic spline function s in ½xiÀ1; xi as an unconstrained optimization problem.