An Advanced Simulation & Computing (ASC) Academic Strategic Alliances Program (ASAP) Center at The University of Chicago The Center for Astrophysical Thermonuclear.

Slides:



Advertisements
Similar presentations
Introducing JavaScript
Advertisements

Utilizing the GDB debugger to analyze programs Background and application.
Tutorial 8: Developing an Excel Application
Tutorial 12: Enhancing Excel with Visual Basic for Applications
Chapter 3 Loaders and Linkers
The Functions and Purposes of Translators Code Generation (Intermediate Code, Optimisation, Final Code), Linkers & Loaders.
An Advanced Simulation & Computing (ASC) Academic Strategic Alliances Program (ASAP) Center at The University of Chicago The Center for Astrophysical Thermonuclear.
The Web Warrior Guide to Web Design Technologies
Lecture 2 Introduction to C Programming
Chapter 7 - Functions. Functions u Code group that performs single task u Specification refers to what goes into and out of function u Design refers to.
An Advanced Simulation & Computing (ASC) Academic Strategic Alliances Program (ASAP) Center at The University of Chicago The Center for Astrophysical Thermonuclear.
VBA Modules, Functions, Variables, and Constants
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
An Advanced Simulation & Computing (ASC) Academic Strategic Alliances Program (ASAP) Center at The University of Chicago The Center for Astrophysical Thermonuclear.
Introduction to C Programming Overview of C Hello World program Unix environment C programming basics.
An Advanced Simulation & Computing (ASC) Academic Strategic Alliances Program (ASAP) Center at The University of Chicago The Center for Astrophysical Thermonuclear.
Guide To UNIX Using Linux Third Edition
Guide To UNIX Using Linux Third Edition
An Advanced Simulation & Computing (ASC) Academic Strategic Alliances Program (ASAP) Center at The University of Chicago The Center for Astrophysical Thermonuclear.
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
CHAPTER 6 FILE PROCESSING. 2 Introduction  The most convenient way to process involving large data sets is to store them into a file for later processing.
An Advanced Simulation & Computing (ASC) Academic Strategic Alliances Program (ASAP) Center at The University of Chicago The Center for Astrophysical Thermonuclear.
Introduction to Array The fundamental unit of data in any MATLAB program is the array. 1. An array is a collection of data values organized into rows and.
CSC 8310 Programming Languages Meeting 2 September 2/3, 2014.
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
Chapter Seven Advanced Shell Programming. 2 Lesson A Developing a Fully Featured Program.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
A First Program Using C#
Java Programming, Second Edition Chapter Four Advanced Object Concepts.
Introduction to FORTRAN
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
Module 1: Introduction to C# Module 2: Variables and Data Types
Introduction to Shell Script Programming
Fortran 1- Basics Chapters 1-2 in your Fortran book.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Purpose  This training course describes how to configure the the C/C++ compiler options.
Tutorial 11 Using and Writing Visual Basic for Applications Code
chap13 Chapter 13 Programming in the Large.
1 Programming Languages Tevfik Koşar Lecture - II January 19 th, 2006.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
1 Functions 1 Parameter, 1 Return-Value 1. The problem 2. Recall the layout 3. Create the definition 4. "Flow" of data 5. Testing 6. Projects 1 and 2.
Shell Script Programming. 2 Using UNIX Shell Scripts Unlike high-level language programs, shell scripts do not have to be converted into machine language.
Introduction to Exception Handling and Defensive Programming.
CIS-165 C++ Programming I CIS-165 C++ Programming I Bergen Community College Prof. Faisal Aljamal.
Unit-1 Introduction Prepared by: Prof. Harish I Rathod
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING.
Advanced Simulation and Computing (ASC) Academic Strategic Alliances Program (ASAP) Center at The University of Chicago The Center for Astrophysical Thermonuclear.
More About Objects and Methods Chapter 5. Outline Programming with Methods Static Methods and Static Variables Designing Methods Overloading Constructors.
Some Fortran programming tips ATM 562 Fall 2015 Fovell (see also PDF file on class page) 1.
DBT544. DB2/400 Advanced Features Level Check Considerations Database Constraints File Overrides Object and Record Locks Trigger Programs.
Beginning Fortran Fortran (77) Advanced 29 October 2009 *Black text on white background provided for easy printing.
1 Debugging and Syntax Errors in C++. 2 Debugging – a process of finding and fixing bugs (errors or mistakes) in a computer program.
1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY.
Chapter 7 - Functions. Functions u Code group that performs single task u Specification refers to what goes into and out of function u Design refers to.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
An Introduction to Programming with C++ Sixth Edition Chapter 5 The Selection Structure.
LECTURE 3 Translation. PROCESS MEMORY There are four general areas of memory in a process. The text area contains the instructions for the application.
Introduction to Algorithmic Processes CMPSC 201C Fall 2000.
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
Chapter 4.  Variables – named memory location that stores a value.  Variables allows the use of meaningful names which makes the code easier to read.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
Lecture 3 Translation.
Chapter VII: Arrays.
In-situ Visualization using VisIt
The Selection Structure
WORKSHOP 3 GSE IMPORT.
Topics Introduction to File Input and Output
SPL – PS1 Introduction to C++.
Presentation transcript:

An Advanced Simulation & Computing (ASC) Academic Strategic Alliances Program (ASAP) Center at The University of Chicago The Center for Astrophysical Thermonuclear Flashes How to create your application: The magic of the setup script Lynn Reid May 23, 2007

The ASC/Alliances Center for Astrophysical Thermonuclear Flashes The University of Chicago Building and Running an Application Grid mesh I/O Runtime Inputs Profiler Simulation/ setup Driver Physics

The ASC/Alliances Center for Astrophysical Thermonuclear Flashes The University of Chicago The setup Script The primary jobs of the setup script are to: qTraverse the FLASH source tree and link necessary files for a given application to the object directory. qFind the target Makefile.h for a given machine. qGenerate the Makefile to make the FLASH executable. qDetermine solution data storage list and create Flash.h qGenerate files needed to add runtime parameters to a given simulation. qGenerate files needed to parse the runtime parameter file.

The ASC/Alliances Center for Astrophysical Thermonuclear Flashes The University of Chicago Simple setup hostname:Flash3>./setup MySimulation -auto setup script will automatically generate the object directory based on the MySimulation problem you specify INCLUDE Driver/DriverMain/TimeDep INCLUDE Grid/GridMain/paramesh/Paramesh3/PM3_package/headers INCLUDE Grid/GridMain/paramesh/Paramesh3/PM3_package/mpi_source INCLUDE Grid/GridMain/paramesh/Paramesh3/PM3_package/source INCLUDE Grid/localAPI INCLUDE IO/IOMain/hdf5/serial/PM INCLUDE PhysicalConstants/PhysicalConstantsMain INCLUDE RuntimeParameters/RuntimeParametersMain INCLUDE Simulation/SimulationMain/Sedov INCLUDE flashUtilities/general INCLUDE physics/Eos/EosMain/Gamma INCLUDE physics/Hydro/HydroMain/split/PPM/PPMKernel INCLUDE physics/Hydro/HydroMain/utilities If you don’t use the -auto flag, you must have a valid Units file in the object FLASH directory (FLASH3/object/Units) Try manually changing IO/IOMain/hdf5/serial/PM to IO/IOMain/hdf5/parallel/PM - Then run setup without the - auto flag Sample Units File

The ASC/Alliances Center for Astrophysical Thermonuclear Flashes The University of Chicago setup Options: use./setup -help -auto Automatically generates the Units file -unit= Forces a specific unit to be used -[123]d Specifies the dimension, default is 2d -nxb= -nyb= -nzb= Specifies number of zones/block, default is 8 -maxblocks= Assigns maxblocks per processor. Defaults are in place but you may want to modify depending on problem and machine specs -site= | -ostype= Allows you to directly specify the host or ostype. Typically setup finds this info but on some machines it isn’t directly accessible. -site=sphere.asci.uchicago.edu or -ostype=Linux -debug | -test -debug: makes compiler put debugging symbols in executable, possibly checks for array out of bounds conditions, etc -test: compiles code with no debugging or optimization options -opt: compiles code for highest performance (default) -portable Normally setup links files from the source directory to the object directory. With -portable files are copied to object dir instead -objdir= By default setup script links all files needed in compilation to the object directory. The -objdir flag allows you to specify a different or new directory -noclobber To setup a simulation over a previous compiled object directory, so that previously included units are not recompiled, saving compilation time -verbose More wordy explanations during setup -parfile= This causes setup to copy the specified file in the simulation directory to the object directory as flash.par

The ASC/Alliances Center for Astrophysical Thermonuclear Flashes The University of Chicago setup Shortcuts qThe Flash3 setup script includes a “shortcuts” feature qAllows many setup options to be included with one keyword qTo use a shortcut, add +shortcut to your setup line qExample: The shortcut ug is defined as: ug:--with-unit=Grid/GridMain/:Grid=UG: prompt>./setup MySimulation -auto +ug this is equivalent to typing in unit options with -unit=Grid/GridMain/UG -unit=IO/IOMain/hdf5/serial/UG (because the appropriate IO is included by default) qLook in Flash3/bin/setup_shortcuts.txt for more examples and to define your own

The ASC/Alliances Center for Astrophysical Thermonuclear Flashes The University of Chicago Important Files Generated by setup setup_call contains the options with which setup was called and the command line resulting after shortcut expansion setup_datafiles contains the complete path of data files copied to the object directory setup_defines contains a list of all pre-process symbols passed to the compiler invocation directly setup_flags contains the exact compiler and linker flags setup_libraries contains the list of libraries and their arguments (if any) which was linked in to generate the executable setup_params contains the list of runtime parameters defined in the Config files processed by setup setup_units contains the list of all units which were included in the current setup setup_vars contains the list of variables, fluxes, species, particle properties, and mass scalars used in the current setup, together with their descriptions

The ASC/Alliances Center for Astrophysical Thermonuclear Flashes The University of Chicago Additional Files created by setup  Flash.h contains q Problem dimensionality and size e.g. NDIM, MAXBLOCKS q Fixed block size dimensionality e.g. NXB, GRID_IJI_GC q Variable, species, flux, mass scalar numbers and list e.g. e.g. NSPECIES, DENS_VAR, EINT_FLUX q Possibly grid geometry GRID_GEOM q PPDEFINE variables showing which units are included e.g. FLASH_GRID_PARAMESH3 qSimulation_mapIntToStr.F90, Simulation_mapStrToInt.F90 q Converts text strings to equivalent index in Flash.h e.g. “dens” maps to DENS_VAR=1 q Similar functionality to FLASH2’s dbaseKeyNumber

The ASC/Alliances Center for Astrophysical Thermonuclear Flashes The University of Chicago Example Makefile.h Located in FLASH3/sites/ MPI_PATH = /usr/local/mpich-intel HDF5_PATH = /usr/local/hdf5-icc NCMPI_PATH = /usr/local/pnetcdf-icc FCOMP = ${MPI_PATH}/bin/mpif90 CCOMP = ${MPI_PATH}/bin/mpicc CPPCOMP = ${MPI_PATH}/bin/mpiCC LINK = ${MPI_PATH}/bin/mpif90 FFLAGS_OPT = -c -r8 -i4 -O3 -real_size 64# -unroll -align -prefetch -pad -ip FFLAGS_DEBUG = -c -g -r8 -i4 -check bounds -check format -check output_conversion -warn all -real_size 64 FFLAGS_TEST = -c -r8 -i4 -O2 -real_size 64 CFLAGS_OPT = -c -O3 -D_LARGEFILE64_SOURCE CFLAGS_DEBUG = -c -g -debug extended -D_LARGEFILE64_SOURCE CFLAGS_TEST = -c -O2 -D_LARGEFILE64_SOURCE CFLAGS_HDF5 = -I $(HDF5_PATH)/include CFLAGS_NCMPI = -I $(NCMPI_PATH)/include CFLAGS_MPI = -I$(MPI_PATH)/include LFLAGS_OPT = -r8 -i4 -Vaxlib -lsvml -Ur -o LFLAGS_DEBUG = -r8 -i4 -Vaxlib -g -o LFLAGS_TEST = -r8 -i4 -Vaxlib -o LIB_HDF5 = -L $(HDF5_PATH)/lib -lhdf5 -lz LIB_MPI = -L$(MPI_PATH)/lib -lfmpich -lmpich LIB_NCMPI = -L$(NCMPI_PATH)/lib -lpnetcdf

The ASC/Alliances Center for Astrophysical Thermonuclear Flashes The University of Chicago Adding a New Simulation  Create a directory with initial Uppercase letter in FLASH3/source/Simulation/SimulationMain  The Simulation directory has problem specific files. It needs :  A Config file describing the Units and runtime parameters needed by this problem  One or more flash.par files which each give a set of runtime parameter values for running the problem in different ways  Data modules for problem-specific parameters or storage  Simulation_data.F90  Code specifying initial conditions  Simulation_init.F90, Simulation_initSpecies.F90, Simulation_initBlock.F90  Makefile indicating necessary Fortran files  Problem specific code replacing default functionality in the main source tree of the code  IO_writeIntegralQuantities.F90, Grid_updateRefinement.F90

The ASC/Alliances Center for Astrophysical Thermonuclear Flashes The University of Chicago Config File qNeeded in each Unit or Simulation directory qDeclare solution variables, fluxes qDeclare runtime parameters q Sets defaults and allowable ranges q Documentation qLists required, requested, exclusive modules qGives Unit-specific pre-processor symbols with PPDEFINE qAllows some implementations choices with LINKIF qVariables, Units are additive down the directory tree qRuntime parameters cannot be duplicated – q first one found wins! q Simulation directory Config file overrides main code qProvides warnings to prevent dumb mistakes

The ASC/Alliances Center for Astrophysical Thermonuclear Flashes The University of Chicago Basic Config File Syntax DEFAULT sub-unit Every unit and subunit designates one implementation to be the ``default''. If no specific implementation of the unit or its sub-units is selected by the application, the designated default implementation gets included EXCLUSIVE implementation… Specify a list of implementations that cannot be included together REQUIRES unit[/sub- unit[/implementation...]] [ OR unit[/sub-unit...]]... Specify a unit requirement. Unit requirements can be general, without asking for a specific implementation, so that unit dependencies are not tied to particular algorithms REQUESTS unit[/sub- unit[/implementation...]] Requests a unit to be added to the Simulation. All requests, are upgraded to a ``REQUIRES'' if they are not negated by a "-without-unit" option from the command line. If negated, the REQUEST is ignored. This can be used to turn off profilers and other ``optional'' units which are included by default. CONFLICTS unit1[/sub- unit[/implementation...]]... Specifies that the current unit, subunit or specific implementation is not compatible with the list of units, subunits or other implemenations list that follows. Setup issues an error if the user attempts to set up a conflicting unit configuration. PARAMETER name type [constant] default [range spec] Specify a runtime parameter. Parameter names are unique up to 20 characters and may not contain spaces. Admissible types include REAL, INTEGER, STRING, and BOOLEAN DATAFILES wildcard Declare that all files matching the given wildcard in the unit directory should be copied over to the object directory.

The ASC/Alliances Center for Astrophysical Thermonuclear Flashes The University of Chicago More Config File Syntax VARIABLE name Register variable with the framework with name name. The setup script collects variables from all the included units, and creates a comprehensive list with no duplications. It then assigns defined constants to each variables and calculates the amount of storage required in the data structures for storing the variables. The defined constants, and the calculates sizes are written to the file Flash.h. FLUX name Register flux variable name with the framework. When using adaptive mesh, flux conservation is needed at fine-coarse boundaries. Paramesh uses a data structure for this purpose, the flux variables provide index into that data structure. SPECIES name An application that uses multiple species uses this keyword to define them MASS_SCALAR name If a quantity is defined with keyword MASS_SCALAR, space is created for it in the ``unk'' data structure. It is treated like any other variable by Paramesh, but the hydrodynamic unit treats it differently. It is advected, but other physical characteristics don't apply to it. GRIDVAR name This keyword is used in connection with the grid scope scratch space supported by FLASH3 (This feature wasn't available in FLASH2). It lets you ask for scratch space for variables specified with this keyword. PPDEFINE name Define a preprocessor symbol which appears in Flash.h. Useful for differentiating Fortran code which depends upon a certain Unit. USESETUPVARS var Provides logical action within setup. LINKIF file unit/directory/path Provides alternate linking routines dependent upon included Unit path.

The ASC/Alliances Center for Astrophysical Thermonuclear Flashes The University of Chicago Config file example Alternate local IO routines Runtime parameters and documentation Additional scratch grid variable Required Units Enforce geometry or other conditions

The ASC/Alliances Center for Astrophysical Thermonuclear Flashes The University of Chicago Now what? Move on to programming the physics and geometry of your problem