Hp XC System 2.x Software Manuel d'utilisateur Page 135

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 154
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 134
A
Examples
This appendix provides examples that illustrate how to buil d a nd run applicati ons on the HP X C
system. The examples in this section show you how to take advantage of some of the many
methods available, and demonstrate a variety of other user commands to monitor, control, or
kill jo bs.
The examples in this section assume that yo u have read the information in previous chapters
describing how to use the HP XC comm a nds to build and run parallel applications. Only
examples of building and running applications are provided in this section detailed
information about the commands is not provided.
A.1 Building and Running a Serial Application
This example s how how to build a simple appli cation, called hello world, and launch it
with the SLU RM srun command.
The f ollow ing is the source code for the hello world program, located in file
hw_hostname.c.
#include <unistd.h>
#include <stdio.h>
int main()
{
char name[100];
gethostname(name, sizeof(name));
printf("%s says Hello!\n", name);
return 0;
}
The hello world program is compiled in the usual way:
$ cc hw_hostname.c -o hw_hostname
When run on the login node, it shows the name of the login node; n16 in this case:
$ ./hw_hostname
n16 says Hello!
srun can b e used to run it on one of the compute nodes. This time it lands on n13:
$ srun ./hw_hostname
n13 says Hello!
srun can also be used to replicate it on several com pute nodes. This is not generally useful, but
is included for illustrative purposes.
$ srun -n4 ./hw_hostname
n13 says Hello!
n13 says Hello!
n14 says Hello!
n14 says Hello!
A.2 Launching a Serial Interactive Shell Through LSF
This section provides an example that shows how to launch a serial interactive shell through
LSF. The bsub -Is comm and is used to launch an interactive shell through LSF. This example
Examples A-1
Vue de la page 134
1 2 ... 130 131 132 133 134 135 136 137 138 139 140 ... 153 154

Commentaires sur ces manuels

Pas de commentaire