Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation fails on Ubuntu #12

Closed
oxcrow opened this issue Aug 3, 2024 · 5 comments
Closed

Compilation fails on Ubuntu #12

oxcrow opened this issue Aug 3, 2024 · 5 comments

Comments

@oxcrow
Copy link

oxcrow commented Aug 3, 2024

Hello,

I'm trying to compile fmetis using gfortran 13.2.0, but the code doesn't compile for some reason.

The first compilation error happens in metis_oo_interface.f90, for expression case(b'000') on line 122.

Here is the error log ...

Error Log (after running cmake and make)
~/work/nmx/lib/ext/fmetis/build  master ✔                                                                                                                                                   
» cmake ..
CMake Deprecation Warning at CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The Fortran compiler identification is GNU 13.2.0
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /usr/bin/f95 - skipped
Configuring build for 32-bit integers
Configuring build for 32-bit reals


Configuration results
---------------------
Fortran compiler: /usr/bin/f95
Build type: Release
Fortran compiler flags: -Wall -cpp -O3 -march=native
Installation prefix: /usr/local
-- Configuring done (0.4s)
-- Generating done (0.0s)
-- Build files have been written to: /home/ares/work/nmx/lib/ext/fmetis/build
                                                                                                                                                                                             
~/work/nmx/lib/ext/fmetis/build  master ✗                                                                                                                                                   
» make
[  5%] Building Fortran object CMakeFiles/fmetis.dir/src/lib/metis_interface.f90.o
[ 11%] Building Fortran object CMakeFiles/fmetis.dir/src/lib/metis_oo_interface.f90.o
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:122:13:

  122 |         case(b'000')
      |             1
Error: Expression in CASE selector at (1) cannot be BOZ
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:123:27:

  123 |             do i = 1, nvxts
      |                           1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:125:69:

  125 |                 write(unit,fstring) (adjncy(j),j=xadj(i),xadj(i+1)-1)
      |                                                                     1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:126:15:

  126 |             end do
      |               1
Error: Expecting END SELECT statement at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:127:13:

  127 |         case(b'001') ! edge weights
      |             1
Error: Expression in CASE selector at (1) cannot be BOZ
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:128:27:

  128 |             do i = 1, nvxts
      |                           1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:130:79:

  130 |                 write(unit,fstring) (adjncy(j),adjwgt(j),j=xadj(i),xadj(i+1)-1)
      |                                                                               1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:131:15:

  131 |             end do
      |               1
Error: Expecting END SELECT statement at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:132:13:

  132 |         case(b'010') ! vertex weights
      |             1
Error: Expression in CASE selector at (1) cannot be BOZ
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:133:27:

  133 |             do i = 1, nvxts
      |                           1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:135:104:

  135 |                 write(unit,fstring) vwgt((i-1)*ncon+1:(i-1)*ncon+ncon),(adjncy(j),j=xadj(i),xadj(i+1)-1)
      |                                                                                                        1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:136:15:

  136 |             end do
      |               1
Error: Expecting END SELECT statement at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:137:13:

  137 |         case(b'100') ! vertex sizes
      |             1
Error: Expression in CASE selector at (1) cannot be BOZ
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:138:27:

  138 |             do i = 1, nvxts
      |                           1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:139:79:

  139 |                 write(unit,fstring) vsize(i), (adjncy(j),j=xadj(i),xadj(i+1)-1)
      |                                                                               1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:140:15:

  140 |             end do
      |               1
Error: Expecting END SELECT statement at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:141:13:

  141 |         case(b'011')
      |             1
Error: Expression in CASE selector at (1) cannot be BOZ
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:142:27:

  142 |             do i = 1, nvxts
      |                           1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:143:115:

  143 |                 write(unit,fstring) vwgt((i-1)*ncon+1:(i-1)*ncon+ncon), (adjncy(j),adjwgt(j),j=xadj(i),xadj(i+1)-1)
      |                                                                                                                   1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:144:15:

  144 |             end do
      |               1
Error: Expecting END SELECT statement at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:145:13:

  145 |         case(b'110')
      |             1
Error: Expression in CASE selector at (1) cannot be BOZ
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:146:27:

  146 |             do i = 1, nvxts
      |                           1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:147:114:

  147 |                 write(unit,fstring) vsize(i), vwgt((i-1)*ncon+1:(i-1)*ncon+ncon),(adjncy(j),j=xadj(i),xadj(i+1)-1)
      |                                                                                                                  1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:148:15:

  148 |             end do
      |               1
Error: Expecting END SELECT statement at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:149:13:

  149 |         case(b'101')
      |             1
Error: Expression in CASE selector at (1) cannot be BOZ
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:150:27:

  150 |             do i = 1, nvxts
      |                           1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:151:89:

  151 |                 write(unit,fstring) vsize(i), (adjncy(j),adjwgt(j),j=xadj(i),xadj(i+1)-1)
      |                                                                                         1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:152:15:

  152 |             end do
      |               1
Error: Expecting END SELECT statement at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:153:13:

  153 |         case(b'111')
      |             1
Error: Expression in CASE selector at (1) cannot be BOZ
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:154:27:

  154 |             do i = 1, nvxts
      |                           1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:155:125:

  155 |                 write(unit,fstring) vsize(i), vwgt((i-1)*ncon+1:(i-1)*ncon+ncon), (adjncy(j),adjwgt(j),j=xadj(i),xadj(i+1)-1)
      |                                                                                                                             1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:156:15:

  156 |             end do
      |               1
Error: Expecting END SELECT statement at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:273:14:

  273 |         case (b'000')
      |              1
Error: Expression in CASE selector at (1) cannot be BOZ
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:274:27:

  274 |             do i = 1, nvtxs
      |                           1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:275:53:

  275 |                 rowcol = count_columns(unit,stat=ios)
      |                                                     1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:276:44:

  276 |                 xadj(i+1) = xadj(i) + rowcol
      |                                            1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:277:56:

  277 |                 read(unit,*) adjncy(xadj(i)+1:xadj(i+1))
      |                                                        1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:278:15:

  278 |             end do
      |               1
Error: Expecting END SELECT statement at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:279:13:

  279 |         case(b'001')
      |             1
Error: Expression in CASE selector at (1) cannot be BOZ
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:280:27:

  280 |             do i = 1, nvtxs
      |                           1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:281:55:

  281 |                 rowcol = count_columns(unit,stat=ios)/2
      |                                                       1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:282:44:

  282 |                 xadj(i+1) = xadj(i) + rowcol
      |                                            1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:283:72:

  283 |                 read(unit,*) (adjncy(j),adjwgt(j),j=xadj(i)+1,xadj(i+1))
      |                                                                        1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:284:15:

  284 |             end do
      |               1
Error: Expecting END SELECT statement at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:285:13:

  285 |         case(b'010')
      |             1
Error: Expression in CASE selector at (1) cannot be BOZ
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:286:27:

  286 |             do i = 1, nvtxs
      |                           1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:287:60:

  287 |                 rowcol = count_columns(unit,stat=ios) - ncon
      |                                                            1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:288:44:

  288 |                 xadj(i+1) = xadj(i) + rowcol
      |                                            1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:289:92:

  289 |                 read(unit,*) vwgt((i-1)*ncon+1:(i-1)*ncon+ncon), adjncy(xadj(i)+1:xadj(i+1))
      |                                                                                            1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:290:15:

  290 |             end do
      |               1
Error: Expecting END SELECT statement at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:291:13:

  291 |         case(b'100')
      |             1
Error: Expression in CASE selector at (1) cannot be BOZ
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:292:27:

  292 |             do i = 1, nvtxs
      |                           1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:293:57:

  293 |                 rowcol = count_columns(unit,stat=ios) - 1
      |                                                         1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:294:44:

  294 |                 xadj(i+1) = xadj(i) + rowcol
      |                                            1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:295:66:

  295 |                 read(unit,*) vsize(i), adjncy(xadj(i)+1:xadj(i+1))
      |                                                                  1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:296:15:

  296 |             end do
      |               1
Error: Expecting END SELECT statement at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:297:13:

  297 |         case(b'011')
      |             1
Error: Expression in CASE selector at (1) cannot be BOZ
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:298:27:

  298 |             do i = 1, nvtxs
      |                           1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:299:64:

  299 |                 rowcol = (count_columns(unit,stat=ios) - ncon)/2
      |                                                                1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:300:44:

  300 |                 xadj(i+1) = xadj(i) + rowcol
      |                                            1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:301:108:

  301 |                 read(unit,*) vwgt((i-1)*ncon+1:(i-1)*ncon+ncon), (adjncy(j),adjwgt(j),j=xadj(i)+1,xadj(i+1))
      |                                                                                                            1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:302:15:

  302 |             end do
      |               1
Error: Expecting END SELECT statement at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:303:13:

  303 |         case(b'110')
      |             1
Error: Expression in CASE selector at (1) cannot be BOZ
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:304:27:

  304 |             do i = 1, nvtxs
      |                           1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:305:64:

  305 |                 rowcol = count_columns(unit,stat=ios) - 1 - ncon
      |                                                                1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:306:44:

  306 |                 xadj(i+1) = xadj(i) + rowcol
      |                                            1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:307:102:

  307 |                 read(unit,*) vsize(i), vwgt((i-1)*ncon+1:(i-1)*ncon+ncon), adjncy(xadj(i)+1:xadj(i+1))
      |                                                                                                      1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:308:15:

  308 |             end do
      |               1
Error: Expecting END SELECT statement at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:309:13:

  309 |         case(b'101')
      |             1
Error: Expression in CASE selector at (1) cannot be BOZ
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:310:27:

  310 |             do i = 1, nvtxs
      |                           1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:311:61:

  311 |                 rowcol = (count_columns(unit,stat=ios) - 1)/2
      |                                                             1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:312:44:

  312 |                 xadj(i+1) = xadj(i) + rowcol
      |                                            1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:313:82:

  313 |                 read(unit,*) vsize(i), (adjncy(j),adjwgt(j),j=xadj(i)+1,xadj(i+1))
      |                                                                                  1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:314:15:

  314 |             end do
      |               1
Error: Expecting END SELECT statement at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:315:13:

  315 |         case(b'111')
      |             1
Error: Expression in CASE selector at (1) cannot be BOZ
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:316:27:

  316 |             do i = 1, nvtxs
      |                           1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:317:68:

  317 |                 rowcol = (count_columns(unit,stat=ios) - 1 - ncon)/2
      |                                                                    1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:318:44:

  318 |                 xadj(i+1) = xadj(i) + rowcol
      |                                            1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:319:118:

  319 |                 read(unit,*) vsize(i), vwgt((i-1)*ncon+1:(i-1)*ncon+ncon), (adjncy(j),adjwgt(j),j=xadj(i)+1,xadj(i+1))
      |                                                                                                                      1
Error: Expected a CASE or END SELECT statement following SELECT CASE at (1)
/home/ares/work/nmx/lib/ext/fmetis/src/lib/metis_oo_interface.f90:320:15:

  320 |             end do
      |               1
Error: Expecting END SELECT statement at (1)
make[2]: *** [CMakeFiles/fmetis.dir/build.make:88: CMakeFiles/fmetis.dir/src/lib/metis_oo_interface.f90.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:112: CMakeFiles/fmetis.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
@oxcrow
Copy link
Author

oxcrow commented Aug 3, 2024

I tried to compile with Intel's ifort compiler, and the code compiles correctly.

Seems like, the compilation error is only in gfortran, possibly due to some missing Fortran 2018 feature.

Since gfortran is the most widely used Fortran compiler, could it be supported?

Here is the log,

Log
~/work/nmx/lib/ext/fmetis/build  master ✔                                                                                                                                                   
» FC=ifort cmake ..
CMake Deprecation Warning at CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The Fortran compiler identification is Intel 2021.5.0.20211109
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /home/ares/opt/intel/oneapi/compiler/2022.0.2/linux/bin/intel64/ifort - skipped
Configuring build for 32-bit integers
Configuring build for 32-bit reals


Configuration results
---------------------
Fortran compiler: /home/ares/opt/intel/oneapi/compiler/2022.0.2/linux/bin/intel64/ifort
Build type: Release
Fortran compiler flags: -warn all -fpp -O3
Installation prefix: /usr/local
-- Configuring done (3.5s)
-- Generating done (0.0s)
-- Build files have been written to: /home/ares/work/nmx/lib/ext/fmetis/build
                                                                                                                                                                                             
~/work/nmx/lib/ext/fmetis/build  master ✗                                                                                                                                                   
» make
[  5%] Building Fortran object CMakeFiles/fmetis.dir/src/lib/metis_interface.f90.o
[ 11%] Building Fortran object CMakeFiles/fmetis.dir/src/lib/metis_oo_interface.f90.o
[ 17%] Linking Fortran static library lib/libfmetis.a
[ 17%] Built target fmetis
[ 23%] Building Fortran object CMakeFiles/test_PartMeshNodal1.dir/src/tests/test_PartMeshNodal1.f90.o
[ 29%] Linking Fortran executable bin/test_PartMeshNodal1
[ 29%] Built target test_PartMeshNodal1
[ 35%] Building Fortran object CMakeFiles/test_PartMeshNodal2.dir/src/tests/test_PartMeshNodal2.f90.o
[ 41%] Linking Fortran executable bin/test_PartMeshNodal2
[ 41%] Built target test_PartMeshNodal2
[ 47%] Building Fortran object CMakeFiles/test_PartGraphRecursive1.dir/src/tests/test_PartGraphRecursive1.f90.o
[ 52%] Linking Fortran executable bin/test_PartGraphRecursive1
[ 52%] Built target test_PartGraphRecursive1
[ 58%] Building Fortran object CMakeFiles/test_PartGraphRecursive2.dir/src/tests/test_PartGraphRecursive2.f90.o
[ 64%] Linking Fortran executable bin/test_PartGraphRecursive2
[ 64%] Built target test_PartGraphRecursive2
[ 70%] Building Fortran object CMakeFiles/test_PartGraphKway.dir/src/tests/test_PartGraphKway.f90.o
[ 76%] Linking Fortran executable bin/test_PartGraphKway
[ 76%] Built target test_PartGraphKway
[ 82%] Building Fortran object CMakeFiles/test_NodeND.dir/src/tests/test_NodeND.f90.o
[ 88%] Linking Fortran executable bin/test_NodeND
[ 88%] Built target test_NodeND
[ 94%] Building Fortran object examples/CMakeFiles/oo_tests.dir/oo_tests.f90.o
[100%] Linking Fortran executable ../bin/oo_tests
[100%] Built target oo_tests

@oxcrow
Copy link
Author

oxcrow commented Aug 3, 2024

I fixed the issue by modifying the code.

Kindly add this git diff patch to fmetis, if it seems correct to you.

The code compiles correctly now, but there are some warnings regarding uninitialized values.

In future, they can potentially cause bugs.

git diff
diff --git a/src/lib/metis_oo_interface.f90 b/src/lib/metis_oo_interface.f90
index d81d7e9..65d7e5e 100644
--- a/src/lib/metis_oo_interface.f90
+++ b/src/lib/metis_oo_interface.f90
@@ -119,38 +119,38 @@ contains
 
 
         select case(fmt)
-        case(b'000')
+        case(int(b'000'))
             do i = 1, nvxts
                 ! v1 v2 v3 ...
                 write(unit,fstring) (adjncy(j),j=xadj(i),xadj(i+1)-1)
             end do
-        case(b'001') ! edge weights
+        case(int(b'001')) ! edge weights
             do i = 1, nvxts
                 ! v1 e1 v2 e2 ...
                 write(unit,fstring) (adjncy(j),adjwgt(j),j=xadj(i),xadj(i+1)-1)
             end do
-        case(b'010') ! vertex weights
+        case(int(b'010')) ! vertex weights
             do i = 1, nvxts
                 ! w1 w2 ... wncon v1 v2 v3 ...
                 write(unit,fstring) vwgt((i-1)*ncon+1:(i-1)*ncon+ncon),(adjncy(j),j=xadj(i),xadj(i+1)-1)
             end do
-        case(b'100') ! vertex sizes
+        case(int(b'100')) ! vertex sizes
             do i = 1, nvxts
                 write(unit,fstring) vsize(i), (adjncy(j),j=xadj(i),xadj(i+1)-1)
             end do
-        case(b'011')
+        case(int(b'011'))
             do i = 1, nvxts
                 write(unit,fstring) vwgt((i-1)*ncon+1:(i-1)*ncon+ncon), (adjncy(j),adjwgt(j),j=xadj(i),xadj(i+1)-1)
             end do
-        case(b'110')
+        case(int(b'110'))
             do i = 1, nvxts
                 write(unit,fstring) vsize(i), vwgt((i-1)*ncon+1:(i-1)*ncon+ncon),(adjncy(j),j=xadj(i),xadj(i+1)-1)
             end do
-        case(b'101')
+        case(int(b'101'))
             do i = 1, nvxts
                 write(unit,fstring) vsize(i), (adjncy(j),adjwgt(j),j=xadj(i),xadj(i+1)-1)
             end do 
-        case(b'111')
+        case(int(b'111'))
             do i = 1, nvxts
                 write(unit,fstring) vsize(i), vwgt((i-1)*ncon+1:(i-1)*ncon+ncon), (adjncy(j),adjwgt(j),j=xadj(i),xadj(i+1)-1)
             end do
@@ -270,49 +270,49 @@ contains
 
         xadj(1) = 0
         select case(fmt)
-        case (b'000')
+        case(int(b'000'))
             do i = 1, nvtxs
                 rowcol = count_columns(unit,stat=ios)
                 xadj(i+1) = xadj(i) + rowcol
                 read(unit,*) adjncy(xadj(i)+1:xadj(i+1))
             end do
-        case(b'001')
+        case(int(b'001'))
             do i = 1, nvtxs
                 rowcol = count_columns(unit,stat=ios)/2
                 xadj(i+1) = xadj(i) + rowcol
                 read(unit,*) (adjncy(j),adjwgt(j),j=xadj(i)+1,xadj(i+1))
             end do
-        case(b'010')
+        case(int(b'010'))
             do i = 1, nvtxs
                 rowcol = count_columns(unit,stat=ios) - ncon
                 xadj(i+1) = xadj(i) + rowcol
                 read(unit,*) vwgt((i-1)*ncon+1:(i-1)*ncon+ncon), adjncy(xadj(i)+1:xadj(i+1))
             end do
-        case(b'100')
+        case(int(b'100'))
             do i = 1, nvtxs
                 rowcol = count_columns(unit,stat=ios) - 1
                 xadj(i+1) = xadj(i) + rowcol
                 read(unit,*) vsize(i), adjncy(xadj(i)+1:xadj(i+1))
             end do
-        case(b'011')
+        case(int(b'011'))
             do i = 1, nvtxs
                 rowcol = (count_columns(unit,stat=ios) - ncon)/2
                 xadj(i+1) = xadj(i) + rowcol
                 read(unit,*) vwgt((i-1)*ncon+1:(i-1)*ncon+ncon), (adjncy(j),adjwgt(j),j=xadj(i)+1,xadj(i+1))
             end do
-        case(b'110')
+        case(int(b'110'))
             do i = 1, nvtxs
                 rowcol = count_columns(unit,stat=ios) - 1 - ncon
                 xadj(i+1) = xadj(i) + rowcol
                 read(unit,*) vsize(i), vwgt((i-1)*ncon+1:(i-1)*ncon+ncon), adjncy(xadj(i)+1:xadj(i+1))
             end do
-        case(b'101')
+        case(int(b'101'))
             do i = 1, nvtxs
                 rowcol = (count_columns(unit,stat=ios) - 1)/2
                 xadj(i+1) = xadj(i) + rowcol
                 read(unit,*) vsize(i), (adjncy(j),adjwgt(j),j=xadj(i)+1,xadj(i+1))
             end do
-        case(b'111')
+        case(int(b'111'))
             do i = 1, nvtxs
                 rowcol = (count_columns(unit,stat=ios) - 1 - ncon)/2
                 xadj(i+1) = xadj(i) + rowcol
Successful Compilation Log
» cmake ..
CMake Deprecation Warning at CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The Fortran compiler identification is GNU 13.2.0
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /usr/bin/f95 - skipped
Configuring build for 32-bit integers
Configuring build for 32-bit reals


Configuration results
---------------------
Fortran compiler: /usr/bin/f95
Build type: Release
Fortran compiler flags: -Wall -cpp -O3 -march=native
Installation prefix: /usr/local
-- Configuring done (0.4s)
-- Generating done (0.0s)
-- Build files have been written to: /home/ares/work/nmx/lib/ext/fmetis/build
                                                                                                                                                                                             
~/work/nmx/lib/ext/fmetis/build  master ✗                                                                                                                                                   
» make
[  5%] Building Fortran object CMakeFiles/fmetis.dir/src/lib/metis_interface.f90.o
[ 11%] Building Fortran object CMakeFiles/fmetis.dir/src/lib/metis_oo_interface.f90.o
[ 17%] Linking Fortran static library lib/libfmetis.a
[ 17%] Built target fmetis
[ 23%] Building Fortran object CMakeFiles/test_PartMeshNodal1.dir/src/tests/test_PartMeshNodal1.f90.o
[ 29%] Linking Fortran executable bin/test_PartMeshNodal1
[ 29%] Built target test_PartMeshNodal1
[ 35%] Building Fortran object CMakeFiles/test_PartMeshNodal2.dir/src/tests/test_PartMeshNodal2.f90.o
[ 41%] Linking Fortran executable bin/test_PartMeshNodal2
[ 41%] Built target test_PartMeshNodal2
[ 47%] Building Fortran object CMakeFiles/test_PartGraphRecursive1.dir/src/tests/test_PartGraphRecursive1.f90.o
[ 52%] Linking Fortran executable bin/test_PartGraphRecursive1
[ 52%] Built target test_PartGraphRecursive1
[ 58%] Building Fortran object CMakeFiles/test_PartGraphRecursive2.dir/src/tests/test_PartGraphRecursive2.f90.o
/home/ares/work/nmx/lib/ext/fmetis/src/tests/test_PartGraphRecursive2.f90:20:33:

   20 |     xadj = [1,4,7,11,15,18,21,23]
      |                                 ^
Warning: ‘xadj.offset’ is used uninitialized [-Wuninitialized]
/home/ares/work/nmx/lib/ext/fmetis/src/tests/test_PartGraphRecursive2.f90:9:42:

    9 |     integer(idx_t), allocatable :: xadj(:), adjncy(:), part(:)
      |                                          ^
note: ‘xadj’ declared here
/home/ares/work/nmx/lib/ext/fmetis/src/tests/test_PartGraphRecursive2.f90:20:33:

   20 |     xadj = [1,4,7,11,15,18,21,23]
      |                                 ^
Warning: ‘xadj.dim[0].lbound’ is used uninitialized [-Wuninitialized]
/home/ares/work/nmx/lib/ext/fmetis/src/tests/test_PartGraphRecursive2.f90:9:42:

    9 |     integer(idx_t), allocatable :: xadj(:), adjncy(:), part(:)
      |                                          ^
note: ‘xadj’ declared here
/home/ares/work/nmx/lib/ext/fmetis/src/tests/test_PartGraphRecursive2.f90:20:33:

   20 |     xadj = [1,4,7,11,15,18,21,23]
      |                                 ^
Warning: ‘xadj.dim[0].ubound’ is used uninitialized [-Wuninitialized]
/home/ares/work/nmx/lib/ext/fmetis/src/tests/test_PartGraphRecursive2.f90:9:42:

    9 |     integer(idx_t), allocatable :: xadj(:), adjncy(:), part(:)
      |                                          ^
note: ‘xadj’ declared here
/home/ares/work/nmx/lib/ext/fmetis/src/tests/test_PartGraphRecursive2.f90:21:58:

   21 |     adjncy = [5,3,2,1,3,4,5,4,2,1,2,3,6,7,1,3,6,5,4,7,6,4]
      |                                                          ^
Warning: ‘adjncy.offset’ is used uninitialized [-Wuninitialized]
/home/ares/work/nmx/lib/ext/fmetis/src/tests/test_PartGraphRecursive2.f90:9:53:

    9 |     integer(idx_t), allocatable :: xadj(:), adjncy(:), part(:)
      |                                                     ^
note: ‘adjncy’ declared here
/home/ares/work/nmx/lib/ext/fmetis/src/tests/test_PartGraphRecursive2.f90:21:58:

   21 |     adjncy = [5,3,2,1,3,4,5,4,2,1,2,3,6,7,1,3,6,5,4,7,6,4]
      |                                                          ^
Warning: ‘adjncy.dim[0].lbound’ is used uninitialized [-Wuninitialized]
/home/ares/work/nmx/lib/ext/fmetis/src/tests/test_PartGraphRecursive2.f90:9:53:

    9 |     integer(idx_t), allocatable :: xadj(:), adjncy(:), part(:)
      |                                                     ^
note: ‘adjncy’ declared here
/home/ares/work/nmx/lib/ext/fmetis/src/tests/test_PartGraphRecursive2.f90:21:58:

   21 |     adjncy = [5,3,2,1,3,4,5,4,2,1,2,3,6,7,1,3,6,5,4,7,6,4]
      |                                                          ^
Warning: ‘adjncy.dim[0].ubound’ is used uninitialized [-Wuninitialized]
/home/ares/work/nmx/lib/ext/fmetis/src/tests/test_PartGraphRecursive2.f90:9:53:

    9 |     integer(idx_t), allocatable :: xadj(:), adjncy(:), part(:)
      |                                                     ^
note: ‘adjncy’ declared here
[ 64%] Linking Fortran executable bin/test_PartGraphRecursive2
[ 64%] Built target test_PartGraphRecursive2
[ 70%] Building Fortran object CMakeFiles/test_PartGraphKway.dir/src/tests/test_PartGraphKway.f90.o
[ 76%] Linking Fortran executable bin/test_PartGraphKway
[ 76%] Built target test_PartGraphKway
[ 82%] Building Fortran object CMakeFiles/test_NodeND.dir/src/tests/test_NodeND.f90.o
[ 88%] Linking Fortran executable bin/test_NodeND
[ 88%] Built target test_NodeND
[ 94%] Building Fortran object examples/CMakeFiles/oo_tests.dir/oo_tests.f90.o
[100%] Linking Fortran executable ../bin/oo_tests
[100%] Built target oo_tests

@ivan-pi
Copy link
Owner

ivan-pi commented Aug 3, 2024

See issue #2.

Strictly speaking, you can just ditch the metis_oo_interface.f90 file. It doesn't offer much extra functionality.

@ivan-pi
Copy link
Owner

ivan-pi commented Aug 3, 2024

The code compiles correctly now, but there are some warnings regarding uninitialized values.

Those are false positives that have to do with allocation on assignment (a F2018 feature). You can turn the warnings off with -Wno-uninitialized. A discussion of the issue can be found here: https://fortran-lang.discourse.group/t/gfortran-uninitialized-warnings/3838/2

@oxcrow
Copy link
Author

oxcrow commented Aug 7, 2024

I noticed that the issue has been fixed with your recent commits.

Thanks!

I will close this issue then, since it's resolved.

@oxcrow oxcrow closed this as completed Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants