在Fortran中创建包含MPI等级编号的文件名

时间:2019-03-18 08:03:13

标签: fortran mpich

我想根据MPI排名创建多个文件(当然还有文件名)。

这是我的代码:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<ul class="megaMenu">
        <li><a href="https://www.google.com/">Menu 1</a>
            <ul class="subMenu">
                <li><a href="https://www.google.com/">Sub Menu 1</a></li>
                <li><a href="https://www.google.com/">Sub Menu 2</a></li>
                <li><a href="https://www.google.com/">Sub Menu 3</a></li>
                <li><a href="https://www.google.com/">Sub Menu 4</a></li>
            </ul>
        </li>
        <li><a href="https://www.google.com/">Menu 2</a>
            <ul class="subMenu">
                <li><a href="https://www.google.com/">Sub Menu 1</a>
                    <ul class="subMenu">
                        <li><a href="https://www.google.com/">Sub_sub Menu 1</a></li>
                        <li><a href="https://www.google.com/">Sub_sub Menu 2</a></li>
                        <li><a href="https://www.google.com/">Sub_sub Menu 3</a></li>
                        <li><a href="https://www.google.com/">Sub_sub Menu 4</a></li>
                    </ul>
                </li>
                <li><a href="https://www.google.com/">Sub Menu 2</a>
                    <ul class="subMenu">
                        <li><a href="https://www.google.com/">Sub_sub Menu 1</a></li>
                        <li><a href="https://www.google.com/">Sub_sub Menu 2</a></li>
                        <li><a href="https://www.google.com/">Sub_sub Menu 3</a></li>
                        <li><a href="https://www.google.com/">Sub_sub Menu 4</a></li>
                    </ul>
                </li>
                <li><a href="https://www.google.com/">Sub Menu 3</a>
                    <ul class="subMenu">
                        <li><a href="https://www.google.com/">Sub_sub Menu 1</a></li>
                        <li><a href="https://www.google.com/">Sub_sub Menu 2</a></li>
                        <li><a href="https://www.google.com/">Sub_sub Menu 3</a></li>
                        <li><a href="https://www.google.com/">Sub_sub Menu 4</a></li>
                    </ul>
                </li>
                <li><a href="https://www.google.com/">Sub Menu 4</a>
                    <ul class="subMenu">
                        <li><a href="https://www.google.com/">Sub_sub Menu 1</a></li>
                        <li><a href="https://www.google.com/">Sub_sub Menu 2</a></li>
                        <li><a href="https://www.google.com/">Sub_sub Menu 3</a></li>
                        <li><a href="https://www.google.com/">Sub_sub Menu 4</a></li>
                    </ul>
                </li>
            </ul>
        </li>
        <li><a href="https://www.google.com/">Menu 3</a>
            <ul class="subMenu">
                <li><a href="https://www.google.com/">Sub Menu 1</a></li>
                <li><a href="https://www.google.com/">Sub Menu 2</a></li>
                <li><a href="https://www.google.com/">Sub Menu 3</a></li>
                <li><a href="https://www.google.com/">Sub Menu 4</a></li>
            </ul>
        </li>
        <li><a href="https://www.google.com/">Menu 4</a>
            <ul class="subMenu">
                <li><a href="https://www.google.com/">Sub Menu 1</a></li>
                <li><a href="https://www.google.com/">Sub Menu 2</a></li>
                <li><a href="https://www.google.com/">Sub Menu 3</a></li>
                <li><a href="https://www.google.com/">Sub Menu 4</a></li>
            </ul>
        </li>
    </ul>

编译良好。但是,当运行可执行文件时,它会报告

 Program aaa
 use mpi
 implicit none
 integer :: mprank, mpsize, wunit=10,ierr
 character :: filename
 MPI_Init(ierr)
 MPI_COMM_SIZE(MPI_COMM_WORLD,mpsize,ierr)
 MPI_COMM_RANK(MPI_COMM_WORLD,mprank,ierr)
 write(filename,'(a,i,a)') 'file',mprank,'.dat'
 open(unit=wunit,file=filename,status='unknown')
 write(wunit,*) 'some texts'
 close(wunit)
 MPI_FINALIZE(ierr)
 End program aaa 

我想知道如何解决这个问题。

0 个答案:

没有答案