Research Article SPOT: A DSL for Extending Fortran Programs with Metaprogramming Songqing Yue and Jeff Gray Department of Computer Science, University of Alabama, Tuscaloosa, AL 35401, USA Correspondence should be addressed to Songqing Yue; syue@cs.ua.edu Received 8 July 2014; Revised 27 October 2014; Accepted 12 November 2014; Published 17 December 2014 Academic Editor: Robert J. Walker Copyright © 2014 S. Yue and J. Gray. his is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. Metaprogramming has shown much promise for improving the quality of sotware by ofering programming language techniques to address issues of modularity, reusability, maintainability, and extensibility. hus far, the power of metaprogramming has not been explored deeply in the area of high performance computing (HPC). here is a vast body of legacy code written in Fortran running throughout the HPC community. In order to facilitate sotware maintenance and evolution in HPC systems, we introduce a DSL that can be used to perform source-to-source translation of Fortran programs by providing a higher level of abstraction for specifying program transformations. he underlying transformations are actually carried out through a metaobject protocol (MOP) and a code generator is responsible for translating a SPOT program to the corresponding MOP code. he design focus of the framework is to automate program transformations through techniques of code generation, so that developers only need to specify desired transformations while being oblivious to the details about how the transformations are performed. he paper provides a general motivation for the approach and explains its design and implementation. In addition, this paper presents case studies that illustrate the potential of our approach to improve code modularity, maintainability, and productivity. 1. Introduction High performance computing (HPC) provides solutions to problems that demand signiicant computational power or problems that require fast access and processing of a large amount of data. HPC programs are usually run on systems such as supercomputers, computer clusters, or grids, which can ofer excellent computational power by decomposing a large problem into pieces, where ideally all of these pieces can be processed concurrently. In the past decades, the hardware architectures used in HPC have evolved signiicantly from supercomputers to clus- ters and grids, while the progress in sotware development has not progressed at the same rate [1]. In fact, HPC was once the primary domain of scientiic computing, but the recent advances in multicore processors as a commodity in most new personal computers are forcing traditional sotware developers to also develop skills in parallel programming in order to harness the newfound power. he recent advances in hardware capabilities impose higher demands on the sotware in HPC. In this work, we have investigated a number of challenges in developing HPC sotware, some of which might be improved with approaches and practices that have long existed in the area of sotware engineering but not yet fully explored in HPC. he initial motivation toward our work comes from the observation that utility functions, such as logging, proiling, and checkpointing, are oten intertwined with and spread between both sequential code and parallel code. his results in poor cohesion where multiple concerns are tangled together and, at the same time, poor coupling where indi- vidual concerns are scattered across diferent methods within multiple modules of a program [2]. In addition, these utility functions are oten wrapped within conditional statements so that they can be toggled on or of on demand. Such condition logic can exacerbate maintenance problems with code evolution. As shown in our early work [2], the utility functions can represent up to 20% of the total lines of code in real-world HPC applications. herefore, one major challenge we deal with in our work involves implementing utility functions in a modularized way without impairing the overall performance. Hindawi Publishing Corporation Advances in Soware Engineering Volume 2014, Article ID 917327, 23 pages http://dx.doi.org/10.1155/2014/917327