{"id":17360725,"url":"https://github.com/ivan-pi/fmetis","last_synced_at":"2026-01-28T17:34:10.593Z","repository":{"id":122101318,"uuid":"141954220","full_name":"ivan-pi/fmetis","owner":"ivan-pi","description":"A modern Fortran interface to the METIS graph partitioning library","archived":false,"fork":false,"pushed_at":"2024-08-05T07:22:37.000Z","size":935,"stargazers_count":48,"open_issues_count":6,"forks_count":10,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-12-20T01:56:44.893Z","etag":null,"topics":["fortran","graph","graph-partitioning","mesh-partitioning","metis","partitioning","reordering","serial","sparse-matrix"],"latest_commit_sha":null,"homepage":"https://ivan-pi.github.io/fmetis/","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ivan-pi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-07-23T03:04:02.000Z","updated_at":"2025-12-13T09:04:35.000Z","dependencies_parsed_at":"2024-01-02T07:04:02.242Z","dependency_job_id":"fe08abfb-6e15-431d-ad1f-02dbd113cd08","html_url":"https://github.com/ivan-pi/fmetis","commit_stats":{"total_commits":48,"total_committers":2,"mean_commits":24.0,"dds":0.3125,"last_synced_commit":"cb6f0abb1f8ff6e9f16bcb2beabb053a04fe6c0b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ivan-pi/fmetis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan-pi%2Ffmetis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan-pi%2Ffmetis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan-pi%2Ffmetis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan-pi%2Ffmetis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivan-pi","download_url":"https://codeload.github.com/ivan-pi/fmetis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan-pi%2Ffmetis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28847847,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T15:15:36.453Z","status":"ssl_error","status_checked_at":"2026-01-28T15:15:13.020Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fortran","graph","graph-partitioning","mesh-partitioning","metis","partitioning","reordering","serial","sparse-matrix"],"created_at":"2024-10-15T19:27:44.606Z","updated_at":"2026-01-28T17:34:10.578Z","avatar_url":"https://github.com/ivan-pi.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fortran METIS Interface\n\n[![Build Status](https://travis-ci.com/ivan-pi/fmetis.svg?branch=master)](https://travis-ci.com/ivan-pi/fmetis)\n[![Issues open](https://img.shields.io/github/issues/ivan-pi/fmetis.svg)](https://github.com/ivan-pi/fmetis/issues)\n\nA modern Fortran interface to the [METIS software package](http://glaros.dtc.umn.edu/gkhome/metis/metis/overview) for partitioning unstructured graphs, partitioning meshes, and computing fill-reducing orderings of sparse matrices.\n\n* [Getting started](#getting-started)\n    - [Specifying the METIS library location](#specifying-the-metis-library-location)\n    - [Using a different compiler](#using-a-different-compiler)\n    - [Specifying the integer and real type precision](#specifying-the-integer-and-real-type-precision)\n    - [Choosing a custom install location](#choosing-a-custom-install-location)\n* [Why Fortran METIS Interface?](#why-fortran-metis-interface)\n* [METIS API](#metis-api)\n* [Example usage](#example-usage)\n* [Documentation](#documentation)\n* [Contributing](#contributing)\n* [License](#license)\n\n## Getting started\n\nTo build and install METIS from source follow the instructions found [here](http://glaros.dtc.umn.edu/gkhome/metis/metis/download). \n\nOn Debian, Ubuntu and related Linux distributions you can install the METIS library, header file, and binaries through the terminal using:\n```\napt-get install libmetis-dev libmetis5 metis\n```\nIf using the [Homebrew](https://brew.sh/) package manager (e.g. on macOS or Linux) you can install METIS using:\n```\nbrew install metis\n```\n\nDownload the Fortran code:\n```\ngit clone https://github.com/ivan-pi/fmetis\n```\n\nTo build and test the Fortran METIS interface, type:\n```\ncd fmetis\nmkdir build\ncd build\ncmake ..\nmake\nctest\n```\n\nStart using METIS in your code by including the following line in your program:\n```Fortran\nuse metis_interface\n```\nTo link your application with the module files and `fmetis` library in the `include/` and `lib/` folders (either in the local build folder or the installed location) use: `gfortran -o myapp -I path/to/include/ -L path/to/lib/ myapp.f90 -lfmetis -lmetis` \n\nDependencies include:\n* a Fortran 2018-compatible compiler,\n* a working METIS library installation, and\n* the CMake build system (v2.8 or higher).\n\n### Specifying the METIS library location\n\nFor non-standard METIS install locations you can manually specify the right library location (either static or shared) like this:\n```\ncmake .. -DMETIS_LIB=\"custom/path/to/libmetis.a\" # or libmetis.so\n```\n\n### Using a different compiler\n\nIf you want to build the Fortran interface with a different compiler (e.g. Intel Fortran, Flang, PGI) specify the `FC` environment variable when calling CMake:\n\n```\nFC=ifort cmake ..\n```\nAlternatively, you can set the CMake Fortran compiler flag the following way:\n```\ncmake .. -DCMAKE_Fortran_COMPILER=ifort\n```\nNote that the generated module files are not compatible between different compilers (or even different versions of a single compiler).\n\n### Specifying the integer and real type precision\n\nBy default, the Fortran interface is built in single precision (32-bit integers and floating point number) matching the declarations in the original `metis.h` header file. Linking the 32 bit Fortran interface with a METIS library compiled using 64 bit integer precision will result in memory allocation errors at runtime. To configure the build for 64 bit signed integers, type:\n\n```\ncmake .. -DINT=64\n```\nA width of 64 should be specified if the number of vertices or the total\nnumber of edges in the graph exceed the limits of a 32 bit signed integer\ni.e., 2^31-1. Just like in the original METIS library, the `c_int32_t` and `c_int64_t` integer types used throughout the interface code must be supported by the Fortran compiler.\n\nFor double precision real variables, type:\n```\ncmake .. -DREAL=64\n```\n\n### Choosing a custom install location\n\nTo install the Fortran METIS interface in a non-default location (e.g. `~/.local/`, type:\n```\ncmake .. -DCMAKE_INSTALL_PREFIX=\"~/.local/\"\nmake install\n```\n\n## Why Fortran METIS Interface?\n\nFortran is still one of the main programming languages used for scientific computing. In many finite element, finite volume, and other scientific codes, the fill-reducing orderings computed by METIS can help reduce the computational requirements of sparse matrix factorization by an order of magnitude. Moreover, the graph partitions produced by METIS can be used to divide meshes for parallel processing. \n\nWhile METIS was already designed with support for calls from Fortran, the C interoperability features available in modern Fortran (`\u003e= 2003`) allow the METIS routines to be called in a simple and safe way that guarantess type checking and avoids issues with compiler name mangling.\n\nThis project was compiled with the aim to organize several resources on interfacing with METIS scattered throughout several internet forums, and thereby reduce the effort of calling METIS routines for new Fortran application developers.\n\n## METIS API\n\nThe following core METIS library routines are available:\n\n```Fortran\n! Graph partitioning routines\nierr = METIS_ParthGraphRecursive(nvtxs,ncon,xadj,adjncy,vwgt,vsize,adjwgt,nparts,tpwgts,ubvec,options,objval,part)\nierr = METIS_PartGraphKway(nvtxs,ncon,xadj,adjncy,vwgt,vsize,adjwgt,nparts,tpwgts,ubvec,options,objval,part)\n\n! Mesh partitioning routines\nierr = METIS_PartMeshDual(ne,nn,eptr,eind,vwgt,vsize,ncommon,nparts,tpwgts,options,objval,epart,npart)\nierr = METIS_PartMeshNodal(ne,nn,eptr,eind,vwgt,vsize,nparts,tpwgts,options,objval,epart,npart)\n\n! Sparse matrix reordering routines\nierr = METIS_NodeND(nvtxs,xadj,adjncy,vwgt,options,perm,iperm)\n\n! Mesh-to-graph conversion routines\nierr = METIS_MeshToDual(ne,nn,eptr,eind,ncommon,numflag,xadj,adjncy)\nierr = METIS_MeshToNodal(ne,nn,eptr,eind,numflag,xadj,adjncy)\n\n! Utility routines\nierr = METIS_SetDefaultOptions(options)\nierr = METIS_Free(ptr)\n```\n\nAll functions return an integer status flag `ierr` that can be checked for success.\n\n## Example usage\n\nExamples of METIS usage from Fortran will be provided soon.\n\n## Documentation\n\nThe latest documentation can be found [here](https://ivan-pi.github.io/fmetis/). The documentation was generated from the source code using [FORD](https://github.com/cmacmackin/ford). To generate the documentation locally run the following command in the root folder of the project (FORD must be installed first):\n```\nford ./project.md\n```\nMore information about METIS can be found on the [original homepage](http://glaros.dtc.umn.edu/gkhome/metis/metis/overview) of the [Karypis Lab](http://glaros.dtc.umn.edu/).\nThe original METIS documentation can be downloaded [here (PDF)](http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/manual.pdf).\n\n## Contributing\n\nPlease submit a bug report or suggest an improvement by opening a [new issue](https://github.com/ivan-pi/fmetis/issues/new). Pull requests are also welcome and can be submitted [here](https://github.com/ivan-pi/fmetis/compare).\n\n## License\n\nThe Fortran METIS Interface source code is being distributed under the [Apache License Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).  See the [LICENSE](https://raw.githubusercontent.com/ivan-pi/fmetis/master/LICENSE) file for further details. To succesfully use the Fortran METIS interface, the Fortran source code must be compiled and linked with the original METIS library that is distributed under the same Apache license (as of METIS version 5.0.3).\n\n---\n\n[Back to top](#fortran-metis-interface)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivan-pi%2Ffmetis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivan-pi%2Ffmetis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivan-pi%2Ffmetis/lists"}