example: whitespace and comment cleanup
This commit is contained in:
parent
8127c24f30
commit
c0a091aed8
@ -19,7 +19,7 @@ int main(int argc, char* argv[])
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &size);
|
||||
MPI_Get_library_version(version, &len);
|
||||
printf("Hello, world, I am %d of %d, (%s, %d)\n",
|
||||
printf("Hello, world, I am %d of %d, (%s, %d)\n",
|
||||
rank, size, version, len);
|
||||
MPI_Finalize();
|
||||
|
||||
|
@ -2,10 +2,11 @@ C
|
||||
C Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
|
||||
C University Research and Technology
|
||||
C Corporation. All rights reserved.
|
||||
C Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
|
||||
C Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
|
||||
C $COPYRIGHT$
|
||||
C
|
||||
C Sample MPI "hello world" application in Fortran 77
|
||||
C Sample MPI "hello world" application using the Fortran mpif.h
|
||||
C bindings.
|
||||
C
|
||||
program main
|
||||
implicit none
|
||||
|
@ -1,10 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
@ -19,7 +20,7 @@ int main(int argc, char* argv[])
|
||||
nproc = _num_pes();
|
||||
proc = _my_pe();
|
||||
|
||||
printf("Hello, world, I am %d of %d\n",
|
||||
printf("Hello, world, I am %d of %d\n",
|
||||
proc, nproc);
|
||||
|
||||
return 0;
|
||||
|
@ -1,7 +1,7 @@
|
||||
!
|
||||
! Copyright (c) 2014 Mellanox Technologies, Inc.
|
||||
! All rights reserved.
|
||||
! Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
|
||||
! Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved.
|
||||
! $COPYRIGHT$
|
||||
!
|
||||
! Additional copyrights may follow
|
||||
@ -21,4 +21,3 @@ program hello_oshmem
|
||||
|
||||
write(*, '("Hello, world, I am ", i2, " of ", i2)') proc, nproc
|
||||
end program hello_oshmem
|
||||
|
||||
|
@ -4,10 +4,11 @@
|
||||
! Corporation. All rights reserved.
|
||||
! Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
! All rights reserved.
|
||||
! Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
|
||||
! Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
|
||||
! $COPYRIGHT$
|
||||
!
|
||||
! Sample MPI "hello world" application in Fortran 90
|
||||
! Sample MPI "hello world" application using the Fortran mpi module
|
||||
! bindings.
|
||||
!
|
||||
program main
|
||||
use mpi
|
||||
|
@ -5,12 +5,13 @@
|
||||
! Corporation. All rights reserved.
|
||||
! Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
! All rights reserved.
|
||||
! Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
|
||||
! Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
|
||||
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
|
||||
! All rights reserved.
|
||||
! $COPYRIGHT$
|
||||
!
|
||||
! Sample MPI "hello world" application using the MPI-3 mpi_f08 module.
|
||||
! Sample MPI "hello world" application using the Fortran mpi_f08
|
||||
! module bindings.
|
||||
!
|
||||
program main
|
||||
use mpi_f08
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
|
||||
*
|
||||
* Simple ring test program
|
||||
* Simple ring test program in C.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -19,7 +19,7 @@ int main(int argc, char *argv[])
|
||||
MPI_Init(&argc, &argv);
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &size);
|
||||
|
||||
|
||||
/* Calculate the rank of the next process in the ring. Use the
|
||||
modulus operator so that the last process "wraps around" to
|
||||
rank zero. */
|
||||
@ -34,9 +34,9 @@ int main(int argc, char *argv[])
|
||||
if (0 == rank) {
|
||||
message = 10;
|
||||
|
||||
printf("Process 0 sending %d to %d, tag %d (%d processes in ring)\n",
|
||||
printf("Process 0 sending %d to %d, tag %d (%d processes in ring)\n",
|
||||
message, next, tag, size);
|
||||
MPI_Send(&message, 1, MPI_INT, next, tag, MPI_COMM_WORLD);
|
||||
MPI_Send(&message, 1, MPI_INT, next, tag, MPI_COMM_WORLD);
|
||||
printf("Process 0 sent to %d\n", next);
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ int main(int argc, char *argv[])
|
||||
and can quit normally. */
|
||||
|
||||
while (1) {
|
||||
MPI_Recv(&message, 1, MPI_INT, prev, tag, MPI_COMM_WORLD,
|
||||
MPI_Recv(&message, 1, MPI_INT, prev, tag, MPI_COMM_WORLD,
|
||||
MPI_STATUS_IGNORE);
|
||||
|
||||
if (0 == rank) {
|
||||
@ -71,7 +71,7 @@ int main(int argc, char *argv[])
|
||||
MPI_Recv(&message, 1, MPI_INT, prev, tag, MPI_COMM_WORLD,
|
||||
MPI_STATUS_IGNORE);
|
||||
}
|
||||
|
||||
|
||||
/* All done */
|
||||
|
||||
MPI_Finalize();
|
||||
|
@ -4,7 +4,7 @@
|
||||
// Corporation. All rights reserved.
|
||||
// Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
|
||||
//
|
||||
// Simple ring test program
|
||||
// Simple ring test program in C++.
|
||||
//
|
||||
// NOTE: The MPI C++ bindings were deprecated in MPI-2.2 and removed
|
||||
// from the standard in MPI-3. Open MPI still provides C++ MPI
|
||||
@ -26,7 +26,7 @@ int main(int argc, char *argv[])
|
||||
MPI::Init();
|
||||
rank = MPI::COMM_WORLD.Get_rank();
|
||||
size = MPI::COMM_WORLD.Get_size();
|
||||
|
||||
|
||||
// Calculate the rank of the next process in the ring. Use the
|
||||
// modulus operator so that the last process "wraps around" to
|
||||
// rank zero.
|
||||
@ -60,7 +60,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (0 == rank) {
|
||||
--message;
|
||||
std::cout << "Process 0 decremented value: " << message
|
||||
std::cout << "Process 0 decremented value: " << message
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ int main(int argc, char *argv[])
|
||||
if (0 == rank) {
|
||||
MPI::COMM_WORLD.Recv(&message, 1, MPI::INT, prev, tag);
|
||||
}
|
||||
|
||||
|
||||
// All done
|
||||
|
||||
MPI::Finalize();
|
||||
|
@ -2,10 +2,10 @@ C
|
||||
C Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
|
||||
C University Research and Technology
|
||||
C Corporation. All rights reserved.
|
||||
C Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
|
||||
C Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
|
||||
C $COPYRIGHT$
|
||||
C
|
||||
C Simple ring test program
|
||||
C Simple ring test program using the mpif.h Fortran bindings.
|
||||
C
|
||||
program ring_f77
|
||||
implicit none
|
||||
@ -25,7 +25,7 @@ C zero.
|
||||
tag = 201
|
||||
next = mod((rank + 1), size)
|
||||
from = mod((rank + size - 1), size)
|
||||
|
||||
|
||||
C If we are the "master" process (i.e., MPI_COMM_WORLD rank 0), put
|
||||
C the number of times to go around the ring in the message.
|
||||
|
||||
@ -35,7 +35,7 @@ C the number of times to go around the ring in the message.
|
||||
write(*, '("Process 0 sending ", i2, " to ", i2, " tag ",
|
||||
& i3, " (", i2, " processes in ring)")')
|
||||
& message, next, tag, size
|
||||
call MPI_SEND(message, 1, MPI_INTEGER, next, tag,
|
||||
call MPI_SEND(message, 1, MPI_INTEGER, next, tag,
|
||||
& MPI_COMM_WORLD, ierr)
|
||||
write(*, '("Process 0 sent to ", i2)')
|
||||
& next
|
||||
@ -49,7 +49,7 @@ C message on to the next process and then quits. By passing the 0
|
||||
C message first, every process gets the 0 message and can quit
|
||||
C normally.
|
||||
|
||||
10 call MPI_RECV(message, 1, MPI_INTEGER, from, tag,
|
||||
10 call MPI_RECV(message, 1, MPI_INTEGER, from, tag,
|
||||
& MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr)
|
||||
|
||||
if (rank .eq. 0) then
|
||||
@ -57,9 +57,9 @@ C normally.
|
||||
write(*, '("Process 0 decremented value: ", i2)') message
|
||||
endif
|
||||
|
||||
call MPI_SEND(message, 1, MPI_INTEGER, next, tag,
|
||||
call MPI_SEND(message, 1, MPI_INTEGER, next, tag,
|
||||
& MPI_COMM_WORLD, ierr)
|
||||
|
||||
|
||||
if (message .eq. 0) then
|
||||
write(*, '("Process ", i2, " exiting")') rank
|
||||
goto 20
|
||||
@ -70,7 +70,7 @@ C The last process does one extra send to process 0, which needs to
|
||||
C be received before the program can exit
|
||||
|
||||
20 if (rank .eq. 0) then
|
||||
call MPI_RECV(message, 1, MPI_INTEGER, from, tag,
|
||||
call MPI_RECV(message, 1, MPI_INTEGER, from, tag,
|
||||
& MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr)
|
||||
endif
|
||||
|
||||
@ -78,4 +78,4 @@ C All done
|
||||
|
||||
call MPI_FINALIZE(ierr)
|
||||
end
|
||||
|
||||
|
||||
|
@ -2,10 +2,10 @@
|
||||
! Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
|
||||
! University Research and Technology
|
||||
! Corporation. All rights reserved.
|
||||
! Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
|
||||
! Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
|
||||
! $COPYRIGHT$
|
||||
!
|
||||
! Simple ring test program
|
||||
! Simple ring test program using the Fortran mpi module bindings.
|
||||
!
|
||||
program ring
|
||||
use mpi
|
||||
@ -24,7 +24,7 @@ program ring
|
||||
tag = 201
|
||||
next = mod((rank + 1), size)
|
||||
from = mod((rank + size - 1), size)
|
||||
|
||||
|
||||
! If we are the "master" process (i.e., MPI_COMM_WORLD rank 0), put
|
||||
! the number of times to go around the ring in the message.
|
||||
|
||||
@ -53,7 +53,7 @@ program ring
|
||||
endif
|
||||
|
||||
call MPI_SEND(message, 1, MPI_INTEGER, next, tag, MPI_COMM_WORLD, ierr)
|
||||
|
||||
|
||||
if (message .eq. 0) then
|
||||
write(*, '("Process ", i2, " exiting")') rank
|
||||
goto 20
|
||||
@ -72,4 +72,4 @@ program ring
|
||||
|
||||
call MPI_FINALIZE(ierr)
|
||||
end program
|
||||
|
||||
|
||||
|
@ -3,12 +3,12 @@
|
||||
! Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
|
||||
! University Research and Technology
|
||||
! Corporation. All rights reserved.
|
||||
! Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
|
||||
! Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
|
||||
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
|
||||
! All rights reserved.
|
||||
! $COPYRIGHT$
|
||||
!
|
||||
! Simple ring test program using the MPI-3 mpi_f08 module.
|
||||
! Simple ring test program using the Fortran mpi_f08 module bindings.
|
||||
!
|
||||
program ring
|
||||
use mpi_f08
|
||||
@ -28,7 +28,7 @@ program ring
|
||||
tag = 201
|
||||
next = mod((rank + 1), size)
|
||||
from = mod((rank + size - 1), size)
|
||||
|
||||
|
||||
! If we are the "master" process (i.e., MPI_COMM_WORLD rank 0), put
|
||||
! the number of times to go around the ring in the message.
|
||||
|
||||
@ -57,7 +57,7 @@ program ring
|
||||
endif
|
||||
|
||||
call MPI_SEND(message, 1, MPI_INTEGER, next, tag, MPI_COMM_WORLD)
|
||||
|
||||
|
||||
if (message .eq. 0) then
|
||||
write(*, '("Process ", i2, " exiting")') rank
|
||||
goto 20
|
||||
@ -76,4 +76,4 @@ program ring
|
||||
|
||||
call MPI_FINALIZE()
|
||||
end program
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user