-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ccddc41
commit eea34b6
Showing
8 changed files
with
178 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
program fileview | ||
use mpi | ||
implicit none | ||
integer :: ierr | ||
integer :: testfile; | ||
integer(kind=mpi_offset_kind) :: disp | ||
integer :: etype, ftype | ||
character(len=MPI_MAX_DATAREP_STRING) :: datarep; | ||
|
||
call MPI_Init(ierr); | ||
|
||
call MPI_File_open(MPI_COMM_WORLD, "test", ior(MPI_MODE_RDWR,MPI_MODE_CREATE), MPI_INFO_NULL, testfile, ierr); | ||
call MPI_File_get_view(testfile, disp, etype, ftype, datarep, ierr); | ||
write(*,*) "get view ", trim(datarep); | ||
call MPI_File_set_view(testfile, disp, etype, ftype, "external32", MPI_INFO_NULL, ierr); | ||
call MPI_File_get_view(testfile, disp, etype, ftype, datarep, ierr); | ||
write(*,*) "get view ", trim(datarep); | ||
call MPI_File_close(testfile, ierr); | ||
|
||
call MPI_Finalize(ierr); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
program infokey | ||
use mpi | ||
implicit none | ||
integer :: ierr | ||
integer :: info | ||
character(len=249) :: val | ||
character(len=MPI_MAX_INFO_KEY) :: key | ||
integer :: vallen | ||
logical :: flag | ||
|
||
call MPI_Init(ierr); | ||
call MPI_Info_create(info, ierr); | ||
call MPI_Info_set(info, " mama ", " mia ", ierr); | ||
call MPI_Info_get_nthkey(info, 0, key, ierr); | ||
write(*,*) "get nth: ", trim(key) | ||
call MPI_Info_get_valuelen(info, " mama ", vallen, flag, ierr); | ||
write(*,*) "get valuelen: ", vallen | ||
call MPI_Info_get(info, " mama ", 249, val, flag, ierr); | ||
write(*,*) "get: ", trim(val) | ||
call MPI_Info_delete(info, " mama ", ierr); | ||
call MPI_Finalize(ierr); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
program main_calls | ||
use mpi | ||
implicit none | ||
integer :: ierr, leng, errcode | ||
integer :: testerrclass, testerrcode | ||
integer :: testcomm | ||
integer :: testtype | ||
integer :: mywin | ||
integer(kind=mpi_address_kind) :: ssize | ||
character(len=MPI_MAX_PROCESSOR_NAME) :: proc_name | ||
character(len=MPI_MAX_LIBRARY_VERSION_STRING) :: lib_ver | ||
character(len=MPI_MAX_ERROR_STRING) :: error_string | ||
character(len=MPI_MAX_OBJECT_NAME) :: comm_string | ||
character(len=MPI_MAX_OBJECT_NAME) :: type_string | ||
character(len=MPI_MAX_OBJECT_NAME) :: win_string | ||
|
||
call MPI_Init(ierr) | ||
|
||
errcode = MPI_ERR_NAME; | ||
|
||
|
||
call MPI_Get_processor_name(proc_name, leng, ierr); | ||
write(*,*) "procname: ", leng, trim(proc_name) | ||
call MPI_Get_library_version(lib_ver, leng, ierr); | ||
write(*,*) "libver: ", leng, trim(lib_ver) | ||
|
||
call MPI_Error_string(errcode, error_string, leng, ierr); | ||
write(*,*) "error: ", errcode, leng, trim(error_string) | ||
call MPI_Add_error_class(testerrclass, ierr); | ||
call MPI_Add_error_code(testerrclass, testerrcode, ierr); | ||
call MPI_Add_error_string(testerrcode, "mouhaha", ierr); | ||
call MPI_Error_string(testerrcode, error_string, leng, ierr); | ||
write(*,*) "custom error: ", leng, trim(error_string) | ||
|
||
call MPI_Comm_dup(MPI_COMM_WORLD, testcomm, ierr); | ||
call MPI_Comm_set_name(testcomm, "my comm", ierr); | ||
call MPI_Comm_get_name(testcomm, comm_string, leng, ierr); | ||
write(*,*) "comm name: ", leng, trim(comm_string) | ||
call MPI_Comm_free(testcomm, ierr); | ||
|
||
call MPI_Type_contiguous(3, MPI_INTEGER, testtype, ierr); | ||
call MPI_Type_commit(testtype, ierr); | ||
call MPI_Type_set_name(testtype, "3 integer", ierr); | ||
call MPI_Type_get_name(testtype, type_string, leng, ierr); | ||
write(*,*) "type name: ", leng, trim(type_string) | ||
call MPI_Type_free(testtype, ierr); | ||
|
||
ssize = 3 | ||
call MPI_Win_create(lib_ver, ssize, 1, MPI_INFO_NULL, MPI_COMM_WORLD, mywin, ierr); | ||
call MPI_Win_set_name(mywin, "test window", ierr); | ||
call MPI_Win_get_name(mywin, win_string, leng, ierr); | ||
write(*,*) "win name: ", leng, trim(win_string) | ||
call MPI_Win_free(mywin, ierr); | ||
|
||
call MPI_Finalize(ierr); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
program port_client | ||
use mpi | ||
implicit none | ||
integer, parameter :: MAX_DATA = 1 | ||
integer :: server | ||
double precision:: buf(MAX_DATA) | ||
integer :: ierr | ||
character(len=MPI_MAX_PORT_NAME) :: port_name | ||
|
||
buf(1) = 3.14 | ||
call MPI_Init(ierr); | ||
write(*,*) "starting client" | ||
call MPI_Barrier(MPI_COMM_WORLD, ierr); | ||
call MPI_Lookup_name("wii", MPI_INFO_NULL, port_name, ierr); | ||
call MPI_Comm_connect(port_name, MPI_INFO_NULL, 0, MPI_COMM_SELF, server, ierr); | ||
call MPI_Send(buf, 1, MPI_DOUBLE_PRECISION, 0, 1, server, ierr); | ||
call MPI_Comm_disconnect(server, ierr); | ||
call MPI_Finalize(ierr); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
program port_server | ||
use mpi | ||
implicit none | ||
integer, parameter :: MAX_DATA = 1 | ||
integer :: client | ||
double precision:: buf(MAX_DATA) | ||
integer :: ierr | ||
character(len=MPI_MAX_PORT_NAME) :: port_name | ||
integer :: statuss(mpi_status_size); | ||
|
||
call MPI_Init(ierr); | ||
call MPI_Open_port(MPI_INFO_NULL, port_name, ierr); | ||
write(*,*) "server available at ", trim(port_name) | ||
call MPI_Publish_name("wii", MPI_INFO_NULL, port_name, ierr); | ||
call MPI_Barrier(MPI_COMM_WORLD, ierr); | ||
call MPI_Comm_accept(port_name, MPI_INFO_NULL, 0, MPI_COMM_SELF, client, ierr); | ||
call MPI_Recv(buf, MAX_DATA, MPI_DOUBLE_PRECISION, MPI_ANY_SOURCE, MPI_ANY_TAG, client, statuss, ierr); | ||
write(*,*) "server received ", buf(1) | ||
call MPI_Comm_disconnect(client, ierr); | ||
call MPI_Unpublish_name("wii", MPI_INFO_NULL, port_name, ierr); | ||
call MPI_Close_port(port_name, ierr); | ||
call MPI_Finalize(ierr); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
source ../etc/mpivars.sh || exit 1 | ||
|
||
|
||
${WI4MPI_ROOT}/bin/mpif90 main.f90 -o main_max_f | ||
${WI4MPI_ROOT}/bin/mpif90 info.f90 -o info_max_f | ||
${WI4MPI_ROOT}/bin/mpif90 fileview.f90 -o fileview_max_f | ||
${WI4MPI_MPRUN} -n 1 ${WI4MPI_NCORE} ${WI4MPI_PARTITION} ${WI4MPI_EXTRA_OPTS} ./main_max_f | ||
${WI4MPI_MPRUN} -n 1 ${WI4MPI_NCORE} ${WI4MPI_PARTITION} ${WI4MPI_EXTRA_OPTS} ./info_max_f | ||
${WI4MPI_MPRUN} -n 1 ${WI4MPI_NCORE} ${WI4MPI_PARTITION} ${WI4MPI_EXTRA_OPTS} ./fileview_max_f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
source ../etc/mpivars.sh || exit 1 | ||
|
||
|
||
${WI4MPI_ROOT}/bin/mpif90 port-client.f90 -o client_f | ||
${WI4MPI_ROOT}/bin/mpif90 port-server.f90 -o server_f | ||
${TESTMPI_ROOT}/bin/mpirun -n 1 wi4mpi -t openmpi ./server_f : -n 1 wi4mpi -t openmpi ./client_f |