C********************************************************************** C testrandom.f C Test Program for Parallel Interger Random Number Generator C C 1998 01/01 C Composed by Hiroaki Watanabec C ver 1.00 C C*********************************************************************** C All Rights Reserved, Copyright (C) 1998, H.Watanabe c/*- c * Copyright (c) 1998 Information Promotion Agency of Japan and H.Watanabe c * All rights reserved. c * c * Redistribution and non-commercial use in source and binary forms, c * with or without modification, are permitted provided that the following c * conditions are met: c * c * 1. Redistributions of source code must retain the above copyright c * notice, this list of conditions and the following disclaimer. c * c * 2. Redistributions in binary form must reproduce the above copyright c * notice, this list of conditions and the following disclaimer in the c * documentation and/or other materials provided with the distribution. c * c * 3. All advertising materials mentioning features or use of this c * software must display the following acknowledgement: c * c * This product includes software developed by Information Promotion c * Agency of Japan and H.Watanabe c * c * 4. The name "Information Promotion Agency" or "H.Watanabe" should not be c * used to endorse or promote products derived from this software c * without specific prior written permission. c * c * 5. Any use of the source code or the binary in a commercial product, c * whether may it be the origial representation or in some modified form, c * is not permitted without specific prior written permission. c * c * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND c * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE c * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE c * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE c * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL c * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS c * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) c * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT c * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY c * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF c * SUCH DAMAGE. c */ include 'mppf.f' include 'leapflogMseq.f' Program Main include 'mppf.h' Integer, Allocatable, Dimension(:) :: iArray Integer iN, iErr, iMyID, iNumPE Integer i, j, iErr, iErr2, iFlag(2) C MPI 環境の初期化と環境情報の取得 call MPP_INIT(iErr) call MPP_COMM_RANK( MPP_COMM_WORLD, iMyID, iErr ) call MPP_COMM_SIZE( MPP_COMM_WORLD, iNumPE, iErr ) C 1 PE 当たりの生成数 (10000 以上とする) iN = 100000 Allocate(iArray(1:iN), STAT=iErr) If (iErr .NE. 0) Then iErr = 1400 goto 9999 End If C 初期化アルゴリズムの選択 iFlag(1) = 1 C 乱数の種 iFlag(2) = 1 C 疑似乱数生成ルーチンの呼び出し call ParallelMseq(iArray, iN, iFlag, iErr) call MPP_BARRIER(MPP_COMM_WORLD, iErr2) C 出力部分。PE番号 0 から順に乱数列を表示 C call MPP_BARRIER(MPP_COMM_WORLD, iErr) If (iMyID .EQ. 0) Then Write(*, *) 'ERROR CODE=', iErr Write(*, 100) 'PE', 'i', 'iA(i)' Write(*, *) '------------------------' End If 100 Format (A5, A5, A12) Do j = 0, iNumPE - 1 If (iMyID .EQ. j) Then Do i = 1, 100 write(*, 1000) j, i, iArray(i) End Do End IF call MPP_BARRIER(MPP_COMM_WORLD, iErr) End Do 1000 Format (I5, I5, I12) 9999 Continue C 終了処理 Call MPP_FINALIZE(iErr) Stop End