TMTMCray XMT™ Programming Environment User's GuideS–2479–20
Cray XMT™ Programming Environment User’s GuidePageH.4 LUC Type Definitions . . . . . . . . . . . . . . . . . . . . . . 159H.5 LUC Callback Functions .
Cray XMT™ Programming Environment User’s Guidefloat_inexactAn error using a floating-point number has occurred. An operationis attempting to use an in
Error Messages [A]prog_prot A program-protection error has occurred. This error occurs whenthe processor attempts to execute an instruction from a PC
Cray XMT™ Programming Environment User’s Guide102 S–2479–20
User Runtime Functions [B]Functions in the runtime library support implicit and explicit parallelism, eventlogging, and trap handling. The compiler in
Cray XMT™ Programming Environment User’s Guidemta_get_num_teamsReturns the number of currently executing teams. See themta_get_num_teams(3) man page.m
User Runtime Functions [B]mta_new_trap1_continuationmta_new_trap1_continuation_blockmta_delete_trap1_continuationmta_register_trap1_continuationmta_un
Cray XMT™ Programming Environment User’s Guidemta_reserve_task_event_countermta_get_task_countermta_get_team_counterReserves or queries hardware count
User Runtime Functions [B]mta_start_event_loggingmta_suspend_event_loggingmta_resume_event_loggingmta_is_event_logging_onmta_set_event_flushTraces buf
Cray XMT™ Programming Environment User’s Guide108 S–2479–20
Compiler Directives and Assertions [C]This appendix provides a complete list of compiler directives specific to theCray XMT and accepted by the Cray X
ContentsPageFiguresFigure 1. Snapshot Library Data Paths . . . . . . . . . . . . . . . . . . 67Figure 2. Comparison of Whole-program and Separate-modu
Cray XMT™ Programming Environment User’s Guidethe safer complex arithmetic performed when complex limited rangeis off. This is especially true when th
Compiler Directives and Assertions [C]#pragma mta debug level [0|1|2|default|none]Set the debug level to the integer constant 0, 1, or 2, or to nodebu
Cray XMT™ Programming Environment User’s Guide#pragma mta fenv_access [on|off|default]This directive specifies whether the full floating-point environ
Compiler Directives and Assertions [C]You can use this pragma in conjunction with the use n streamsto ask the compiler to allocate a certain number of
Cray XMT™ Programming Environment User’s Guide#pragma mta fused muladd [on|off|default]This directive specifies whether the compiler is allowed to com
Compiler Directives and Assertions [C]#pragma mta instantiate [none|all|used|local|default]When used inside a template declaration, the effect of this
Cray XMT™ Programming Environment User’s Guidenum_streams is the number of streams the compiler requests for eachprocessor. For loop future parallel l
Compiler Directives and Assertions [C]The output from canal shows that they are both placed into parallelregion 1:| for (int i = 0; i < size_foobar
Cray XMT™ Programming Environment User’s GuideHowever, when you add the may merge option these two loopsremain in the same region:| for (int i = 0; i
Compiler Directives and Assertions [C]#pragma no mem initThis directive affects only the declaration statement immediatelyfollowing the directive and
Cray XMT™ Programming Environment User’s Guide#pragma mta no scalar expansionThis directive instructs the compiler not to expand scalar variables tove
Compiler Directives and Assertions [C]In this case, the compiler is forced to choose one of two possibleimplementations. To avoid ambiguity when contr
Cray XMT™ Programming Environment User’s Guidevariable to be updated must occur as the target on the left side of thestatement and must occur exactly
Compiler Directives and Assertions [C]are performed by 20 threads, the first thread executes iteration 1,iteration 21, iteration 41, and so forth. Thi
Cray XMT™ Programming Environment User’s GuideC.2 Parallelization DirectivesThe compiler recognizes the following parallelization directives.#pragma m
Compiler Directives and Assertions [C]of the file or until another directive of the same kind is encountered.The directive is ignored if the -nopar fl
Cray XMT™ Programming Environment User’s GuideThe compiler recognizes the following semantic assertions:#pragma mta assert can replace variable-listTh
Compiler Directives and Assertions [C]#pragma mta assert parallelThis directive can appear before a loop construct and asserts that theseparate iterat
Cray XMT™ Programming Environment User’s Guide#pragma mta assert no dependence variable-list#pragma mta assert nodep variable-listThis directive can a
Compiler Directives and Assertions [C]However, if we add a #pragma mta may reorderSYNCARRAY$ directive before the loop, each reference toSYNCARRAY$ ma
Introduction [1]This guide describes the Cray XMT Programming Environment. It includesprocedures and examples that show you how to set up your user en
Cray XMT™ Programming Environment User’s GuideAlternatively, you can use the following syntax for dynamicallyallocated arrays.#pragma mta assert par_n
Compiler Directives and Assertions [C]The compiler tests for case n first, and all other cases after that. nmust be an integer constant, in any radix.
Cray XMT™ Programming Environment User’s Guide132 S–2479–20
Condition Codes [D]You can test the condition codes generated by an expression by using theMTA_TEST_CC intrinsic. The eight possible condition code va
Cray XMT™ Programming Environment User’s GuideName DescriptionIF_ZE x = 0 (integer, unsigned, float)IF_F x = 0 (logical)IF_NE y != z (integer, unsigne
Condition Codes [D]Name DescriptionIF_3 Overflow/NaN, no carryIF_4 Zero, carryIF_5 Negative, carryIF_6 Positive, carryIF_7 Overflow/NaN, carryIF_N0 No
Cray XMT™ Programming Environment User’s Guide136 S–2479–20
Data Types [E]This chapter provides information about the C and C++ language data types thatyou can use with Cray XMT compilers.The floating-point typ
Cray XMT™ Programming Environment User’s GuideThe Cray XMT C and C++ compilers also support the ten nonstandard integer typesin the following list. Th
Keywords [F]The C and C++ languages reserve certain words for use as keywords. You cannot usethese words for any other purpose. For example, you canno
Cray XMT™ Programming Environment User’s Guide14 S–2479–20
Cray XMT™ Programming Environment User’s GuideThe -no_bool compiler switch disables the bool, false and true keywords.The -no_wchar compiler switch di
Keywords [F]The following reserved words have been added by Cray to both the C and C++languages for use on the Cray XMT platform.future__future Both a
Cray XMT™ Programming Environment User’s GuideThe following reserved words have been added by Cray to the C language for use onthe Cray XMT platform.
MTA_PARAMS [G]The environment variable MTA_PARAMS is used by the Cray XMT user runtime. Thefollowing list contains the values that you can set for MTA
Cray XMT™ Programming Environment User’s Guideu Underflow. Traps underflows that occur. Underflowsproduce a rounded result smaller in magnitudethan 0x
MTA_PARAMS [G]pc_hash n, m, lSpecifies the hash size n, age threshold m, and dump threshold l of anevent. The has size determines the number of event
Cray XMT™ Programming Environment User’s Guide146 S–2479–20
LUC API Reference [H]The XMT-PE contains two user-level libraries for LUC, libluc.a, that use a C++interface. One version of libluc.a is built for Lin
Cray XMT™ Programming Environment User’s GuideThe LucEndpoint class provides the interface methods that the application uses tocall functions on a rem
LUC API Reference [H]H.2 luc_allocate_endpoint FunctionUse luc_allocate_endpoint to construct LucEndpoint objects. Thedefault value for LucServiceType
Setting Up the User Environment [2]Configuring your user environment on a Cray XMT system is similar to configuring atypical Linux workstation.2.1 Set
Cray XMT™ Programming Environment User’s GuideParametersthreadCountSpecifies the number of server threads that are assigned to an object.Note: The MTK
LUC API Reference [H]Gets the ID of the endpoint. This method is valid only after startService hasreturned.Return CodesThis method returns the endpoin
Cray XMT™ Programming Environment User’s GuideParametersserverEndpointSpecifies the endpoint identifier for the desired server of this RPC.serviceType
LUC API Reference [H]H.3.5 remoteCallSync MethodMakes a synchronous remote procedure call.Syntaxluc_error_t remoteCallSync(luc_endpoint_id_t serverEnd
Cray XMT™ Programming Environment User’s GuideReturn CodesLUC_ERR_OK The remote procedure call was completed. Data may have beenreturned.LUC_ERR_NOT_S
LUC API Reference [H]ParametersserviceTypeSpecifies the service type of the service being provided.serviceFunctionIndexSpecifies the specific function
Cray XMT™ Programming Environment User’s GuideValues to use for this option:LUC_DBG_NONE — The library logs assertionsthat are fatal to the applicatio
LUC API Reference [H]Values to use for this option: powers-of-two from 1MB to 256 MBs, inclusive.LUC_CONFIG_SWAP_CLIENT_INBOUNDLUC_CONFIG_SWAP_CLIENT_
Cray XMT™ Programming Environment User’s GuideThis key is not valid for Linux endpoints.Values to use for this option: powers of two from 1MB to 256 M
LUC API Reference [H]Parameterskey Identifies the configuration option to get. For a list of configurationoptions, see setConfigValue Method on page 1
Cray XMT™ Programming Environment User’s Guide4. Connect to the remote host by typing the following commands.If you are using a C shell, type:% eval s
Cray XMT™ Programming Environment User’s GuideH.5 LUC Callback FunctionsThe LucEndpoint class uses the following callback functions:• LUC_RPC_Function
LUC API Reference [H]ParametersinData (input parameter)Specifies a pointer to a buffer containing input data to the remotefunction. NULL if there is n
Cray XMT™ Programming Environment User’s GuideH.5.3 LUC_Completion_HandlerThe LUC_Completion_Handler callback function is used by a client forasynchro
LUC API Reference [H]LUC_ERR_OK • The function was registered successfully.• This object is ready to accept remote requests.• The remote procedure cal
Cray XMT™ Programming Environment User’s GuideLUC_ERR_BAD_PARAMETER• The specified service type or function index is out of range.• The specified conf
LUC API Reference [H]LUC_ERR_FIOThe (MTK) LUC Library received an unexpected error from the FastI/O System Call Library.LUC_ERR_INVALID_ENDPOINTThe en
Cray XMT™ Programming Environment User’s Guide166 S–2479–20
GlossarybarrierIn code, a barrier is used after a phase. The barrier delays the streams that wereexecuting parallel operations in the phase until all
Cray XMT™ Programming Environment User’s GuidefutureImplements user-specified or explicit parallelism by creating a continuation thatpoints to a seque
GlossaryrecurrenceOccurs when a loop uses values computed in one iteration in subsequent iterations.These subsequent uses of the value imply loop-carr
Setting Up the User Environment [2]2.2 Using ModulesThe Cray XMT system uses modules in the user environment to support multipleversions of software,
Cray XMT™ Programming Environment User’s Guide2.2.3 Module CommandsThe mta-pe modules are loaded by default.To find out what modules have been loaded,
Developing an Application [3]This chapter provides an overview of some Cray XMT functions and describes howto perform some common programming tasks, s
© 2007–2011 Cray Inc. All Rights Reserved. This document or parts thereof may not be reproduced in any formunless permitted by contract or by written
Cray XMT™ Programming Environment User’s GuideThe xmt-tools module contains the tools that you use to run and monitor aprogram. To run a program, use
Developing an Application [3]When a set of generic functions access a multiword variable simultaneously, theresulting behavior depends on the generic
Cray XMT™ Programming Environment User’s GuideThe Cray XMT compiler recognizes the following generic write functions.writeef(&v, value)Writes valu
Developing an Application [3]The Cray XMT compiler recognizes the following generic read functions.readfe(&v)Returns the value of variable v when
Cray XMT™ Programming Environment User’s Guide3.2.2 Intrinsic FunctionsCray provides intrinsic functions for the Cray XMT system that allow direct acc
Developing an Application [3]3.3.1 Synchronizing Data Using int_fetch_addUse the int_fetch_add generic function to synchronize updates to data thatrep
Cray XMT™ Programming Environment User’s GuideIn these two cases, each reference to x$ results in a separate read of that variableand requires a separ
Developing an Application [3]A number with a biased exponent of 2047 (0x7FF) is a special floating-pointnumber, known as a SpecialFloat64 on the Cray
Cray XMT™ Programming Environment User’s GuideSubnormal numbers are less precise than normalized numbers. The smallestsubnormal number, min_denorm, ha
Developing an Application [3]Ortemp1 = a*b;temp2 = c*d;x = temp1 + temp2;The only way to override the compiler instructions for a particular multiply-
RECORD OF REVISIONS–2479–20 Published May 2011 Supports release 2.0 GA running on Cray XMT compute nodes and on Cray XT3.1UP02 service nodes. This rel
Cray XMT™ Programming Environment User’s Guide3.4.3 32-bit and 64-bit Implementation of Floating-point ArithmeticThe double data type in C uses the fo
Developing an Application [3]The current rounding mode for the math library is set to round to the nearest place(RND_NEAR). User functions that change
Cray XMT™ Programming Environment User’s GuideFuture statements contain the name of a future variable and parameters, a body, anda return statement. T
Developing an Application [3]Continuations are normally allocated and deallocated from the heap. However, ifthe associated future variable is a scalar
Cray XMT™ Programming Environment User’s Guide3.5.2 Anonymous futuresOften, a concurrent computation does not have a return value. An example of sucha
Developing an Application [3]Example 2. Retrieving a condition code and result of a previous operationIt is also possible to test the condition code g
Cray XMT™ Programming Environment User’s Guide3.7 File I/OThe Cray XMT performs I/O to a RAM-based file system (RAMFS) and a networkfile system (NFS).
Developing an Application [3]The actual sequence of lines is random because the different iterations are allexecuted in parallel. However, for a seque
Cray XMT™ Programming Environment User’s GuideIn the previous code, flag$ controls access to file f, ensuring that the combinationof fseek and fread a
Developing an Application [3]If many parallel calls refer to the same file, locking forces a serial execution order.For example, in the following code
Cray XMT™ Programming Environment User’s GuideExample 7. Calling UNIX I/O functions from parallel codeIn serial code, the low-level UNIX functions beh
Developing an Application [3]Example 8. Using synchronization with UNIX I/O functionsTo correct this problem, you can either rewrite the code in the s
Cray XMT™ Programming Environment User’s GuideInternally, the UNIX library enforces locking for each file descriptor so that outputto multiple files c
Developing an Application [3]3.8 Porting Programs to the Cray XMTUse the following information when you prepare to port C and C++ programs tothe Cray
Cray XMT™ Programming Environment User’s Guideerrno.h errno is thread-specific and not a global variable.Files that use errno in the same way that it
Developing an Application [3]Cray XMT keywordsYou can disable Cray XMT specific keywords (forexample, sync and future) by using the compilerflag -no_m
Cray XMT™ Programming Environment User’s Guide46 S–2479–20
Shared Memory Between Processes [4]You can share memory between multiple programs by creating a shared memoryregion using the mmap system call.4.1 Map
Cray XMT™ Programming Environment User’s GuideIn the previous example, a new readable and writable file is created by using theopen system call with t
Shared Memory Between Processes [4]4.2 Persisting Shared MemoryThe remember daemon rememd retains information about shared memory so thatprograms pres
Changes to this DocumentCray XMT™ Programming Environment User's Guide S–2479–20This rewrite of Cray XMT Programming Environment User's Guid
Cray XMT™ Programming Environment User’s GuideUse the following functions to call rememd from a program.persist_rememberCauses the rememd daemon to ca
Shared Memory Between Processes [4]}mmap_addr = mmap(0, mmap_len, PROT_WRITE, MAP_ANON | MAP_SHARED, fd, 0);if (MAP_FAILED == mmap_addr) {printf("
Cray XMT™ Programming Environment User’s Guide52 S–2479–20
Developing LUC Applications [5]This chapter describes how to use the LUC library in your application. The followingtasks are discussed:• Constructing
Cray XMT™ Programming Environment User’s GuideProcedure 3. Creating and using a LUC client object1. Include the header file <luc/luc_exported.h>
Developing LUC Applications [5]9. Stop the service by calling stopService. This releases any nearby memorythat was allocated by the endpoint, closes a
Cray XMT™ Programming Environment User’s Guideresult = clientEndpoint->remoteCallSync(serverID,QUERY_ENGINE, FUNC_QUERY1,inbuf, INBUF_SIZE, outbuf,
Developing LUC Applications [5]shutdown the service. For instance, if a serious application internal error occursor an application shutdown request is
Cray XMT™ Programming Environment User’s Guideluc_service_type_t serviceType,int serviceFunctionIndex,void * userHandle,luc_error_t remoteLucError){//
Developing LUC Applications [5]else if (lucError < LUC_ERR_MAX)// LUC library generated error codeelse// user remote function return value//// An a
Cray XMT™ Programming Environment User’s Guidevoid LucServerOnlyUsageModel(void){// First create a communication endpoint. This is used to accept call
Developing LUC Applications [5]Then the client can be run multiple times using the following command:% exluc -c idWhere id is the server endpoint ID p
Cray XMT™ Programming Environment User’s Guide#define NetworkToHost(b,l) ByteSwap((b),(l))#define HostToNetwork(b,l) ByteSwap((b),(l))#endif// The LUC
Developing LUC Applications [5]// Reduction service.// This routine is called by the LUC server library// when a client request of type// (svc_type,re
Cray XMT™ Programming Environment User’s Guideerr = svrEndpoint->registerRemoteCall(svc_type, reduce_func_idx, reduce);if (err != LUC_ERR_OK){fprin
Developing LUC Applications [5]// If no valid options were given, print the program usage message.fprintf(stderr,"Usage: exluc -c id | -s\n"
Cray XMT™ Programming Environment User’s GuideInitialize the memory region variables from the global variables when creatingthe LUC Endpoint object. C
Managing Lustre I/O with the SnapshotLibrary [6]6.1 About the Snapshot LibraryThe Cray XMT snapshot library provides a high speed bulk data transfer f
Cray XMT™ Programming Environment User’s GuideThe easiest way to understand this is to imagine data going to a file from theapplication. In this case,
Managing Lustre I/O with the Snapshot Library [6]For large data transfers starting at the beginning of a file, the best functions to useare dslr_snaps
ContentsPageIntroduction [1] 131.1 The Cray XMT Programming Environment . . . . . . . . . . . . . . . . . 13Setting Up the User Environment [2]152.1 S
Cray XMT™ Programming Environment User’s GuideA typical application might use dslr_pread and dslr_pwrite in the followingmanner:1. Start up and alloca
Managing Lustre I/O with the Snapshot Library [6]If the underlying file system is naturally serial (NFS, for example) its performanceis constrained by
Cray XMT™ Programming Environment User’s Guidememset(testBuffer, 0, DEFAULT_BUFFER_SIZE);// Restore a snapshot dataset from disk back into memory.err
Managing Lustre I/O with the Snapshot Library [6]While these functions are useful for transferring small quantities of data to or fromarbitrary locati
Cray XMT™ Programming Environment User’s Guide6.5 Managing File I/O on File Systems Other Than LustreUsing the snapshot library to read and write file
Compiler Overview [7]This chapter provides an overview of the Cray XMT compilers. You need tounderstand these concepts before you compile your program
Cray XMT™ Programming Environment User’s Guide7.1 The Compilation ProcessThere are two major phases of building a program executable from a number ofs
Compiler Overview [7]The compilation processes for these modes differ in the following ways:Whole-program compilationThis is the preferred method for
Cray XMT™ Programming Environment User’s GuideFigure 2. Comparison of Whole-program and Separate-module ModesWhole-program Compilationskinny .o FilesP
Compiler Overview [7]In separate-module mode, the .o files are true object files. The compiler optimizeseach object file, or module, separate from the
Cray XMT™ Programming Environment User’s GuidePage3.6 Testing Expressions Using Condition Codes . . . . . . . . . . . . . . . . 343.7 File I/O . . . .
Cray XMT™ Programming Environment User’s Guide7.2 Invoking the CompilerYou can only use the Cray XMT compiler when the Cray XMT ProgrammingEnvironment
Compiler Overview [7]The following examples show how to use the compiler options for various compilertasks using the whole-program and separate-module
Cray XMT™ Programming Environment User’s GuideWhen you use the -pl and -c options to compile a source file, the compilerperforms the following tasks d
Compiler Overview [7]This produces (barring errors in the source file) a traditional, or fat, object fileddot.o. To produce the two fat object files d
Cray XMT™ Programming Environment User’s Guide7.4 Inlining FunctionsInline expansion, commonly known as inlining, occurs when the compiler replaces af
Compiler Overview [7]7.5 Optimizing ParallelizationYou can control how the compiler makes your program parallel in two ways:• You can add parallelizat
Cray XMT™ Programming Environment User’s GuideParallelism that you specify with future statements in your program is alwaysenabled. Compiler options h
Compiler Overview [7]7.7 Creating New LibrariesYou can create a user-defined library in the same way that you build a program inwhole-program mode. To
Cray XMT™ Programming Environment User’s Guide7.8 Compiler MessagesThere are three categories for compiler messages: errors, warnings, and remarks.Err
Compiler Overview [7]7.10 Using Compiler Directives and AssertionsDirectives are metalanguage constructs that you can add to a program to influencehow
ContentsPage7.9 Setting Debugger Options during Compilation . . . . . . . . . . . . . . . . 887.10 Using Compiler Directives and Assertions . . . . .
Cray XMT™ Programming Environment User’s Guide90 S–2479–20
Running an Application [8]This chapter contains procedures for launching your application on the Cray XMT.8.1 Launching the ApplicationYou use the mta
Cray XMT™ Programming Environment User’s GuideThe mtarun command uses a default configuration file, .mtarunrc, which existsin your home directory. You
Running an Application [8]8.3 Improving PerformanceFor information about improving performance on your program, see Cray XMTPerformance Tools User&apo
Cray XMT™ Programming Environment User’s Guide94 S–2479–20
Optional Optimizations [9]9.1 Scalar Replacement of AggregatesEffective with version 2.0 of the Cray XMT software, the XMT compiler providesan optiona
Cray XMT™ Programming Environment User’s GuideAfter recompiling this code with automatic scalar replacement enabled, the compileris able to transform
Optional Optimizations [9]Alternatively, you can enable scalar replacement for individual aggregates by usingthe mta assert can replace pragma. This p
Cray XMT™ Programming Environment User’s Guideto fields of the aggregate inside the loop will be replaced with the temporaries. Thiscan be useful if s
Error Messages [A]Execution-time errors are directly related to exceptions. An exception is anunexpected condition raised by an event in your program,
Kommentare zu diesen Handbüchern