{"id":21525567,"url":"https://github.com/sciinstitute/sci-solver_fem","last_synced_at":"2025-12-16T15:41:06.367Z","repository":{"id":24345060,"uuid":"27742950","full_name":"SCIInstitute/SCI-Solver_FEM","owner":"SCIInstitute","description":"SCI-Solver_FEM is a C++/CUDA library written to solve an FEM linear system. It is designed to solve the FEM system quickly by using GPU hardware.","archived":false,"fork":false,"pushed_at":"2019-02-22T18:33:47.000Z","size":3475,"stargazers_count":93,"open_issues_count":2,"forks_count":28,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-09T23:36:33.262Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Cuda","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SCIInstitute.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-09T01:03:25.000Z","updated_at":"2025-03-26T18:01:39.000Z","dependencies_parsed_at":"2022-09-05T16:30:51.711Z","dependency_job_id":null,"html_url":"https://github.com/SCIInstitute/SCI-Solver_FEM","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/SCIInstitute/SCI-Solver_FEM","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SCIInstitute%2FSCI-Solver_FEM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SCIInstitute%2FSCI-Solver_FEM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SCIInstitute%2FSCI-Solver_FEM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SCIInstitute%2FSCI-Solver_FEM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SCIInstitute","download_url":"https://codeload.github.com/SCIInstitute/SCI-Solver_FEM/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SCIInstitute%2FSCI-Solver_FEM/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268512159,"owners_count":24261887,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-24T01:36:54.489Z","updated_at":"2025-12-16T15:41:01.304Z","avatar_url":"https://github.com/SCIInstitute.png","language":"Cuda","funding_links":[],"categories":[],"sub_categories":[],"readme":"GPUTUM : FEM Solver\n==============\n\nGPUTUM FEM Solver is a C++/CUDA library written to solve an FEM linear system. It is designed to solve the FEM system quickly by using GPU hardware.\n\nThe code was written by Zhisong Fu and T. James Lewis at the Scientific Computing and Imaging Institute, \nUniversity of Utah, Salt Lake City, USA. The theory behind this code is published in the papers linked below. \nTable of Contents\n========\n\u003cimg src=\"https://raw.githubusercontent.com/SCIInstitute/SCI-Solver_FEM/master/src/Resources/fem.png\"  align=\"right\" hspace=\"20\" width=350\u003e\n- [FEM Aknowledgements](#fem-aknowledgements)\n- [Requirements](#requirements)\n- [Building](#building)\u003cbr/\u003e\n\t\t- [Linux and OSX](#linux-and-osx)\u003cbr/\u003e\n\t\t- [Windows](#windows)\u003cbr/\u003e\n- [Running Examples](#running-examples)\n- [Using the Library](#using-the-library)\n- [Testing](#testing)\u003cbr/\u003e\n\n\u003cbr/\u003e\n\n\u003ch4\u003eFEM Aknowledgements\u003c/h4\u003e\n**\u003ca href =\"http://www.sciencedirect.com/science/article/pii/S0377042713004470\"\u003e\nArchitecting the Finite Element Method Pipeline for the GPU\u003c/a\u003e**\u003cbr/\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/SCIInstitute/SCI-Solver_FEM/master/src/Resources/fem2.png\"  align=\"right\" hspace=\"20\" width=360\u003e\n\n**AUTHORS:**\n\u003cbr/\u003eZhisong Fu(*a*) \u003cbr/\u003e\nT. James Lewis(*b*) \u003cbr/\u003e\nRobert M. Kirby(*a*) \u003cbr/\u003e\nRoss T. Whitaker(*a*) \u003cbr/\u003e\n\nThis library solves for the partial differential equations and coefficients values \non vertices located on a tetrahedral or triangle mesh on the GPU. Several mesh formats\nare supported, and are read by the \u003ca href=\"http://wias-berlin.de/software/tetgen/\"\u003eTetGen Library\u003c/a\u003e and the\n \u003ca href=\"http://graphics.stanford.edu/software/trimesh/\"\u003eTriMesh Library\u003c/a\u003e. \nThe \u003ca href=\"http://glaros.dtc.umn.edu/gkhome/metis/metis/download\"\u003eMETIS library\u003c/a\u003e is used to partition unstructured \nmeshes. \u003ca href=\"https://code.google.com/p/googletest/\"\u003e\nGoogle Test\u003c/a\u003e is used for testing.\n\u003cbr/\u003e\u003cbr/\u003e\nRequirements\n==============\n\n * Git, CMake (3.0+ recommended), and the standard system build environment tools.\n * You will need a CUDA Compatible Graphics card. See \u003ca href=\"https://developer.nvidia.com/cuda-gpus\"\u003ehere\u003c/a\u003e You will also need to be sure your card has CUDA compute capability of at least 2.0.\n * SCI-Solver_FEM is compatible with the latest CUDA toolkit (7.0). Download \u003ca href=\"https://developer.nvidia.com/cuda-downloads\"\u003ehere\u003c/a\u003e.\n * This project has been tested on OpenSuse 12.3 (Dartmouth) on NVidia GeForce GTX 570 HD, Ubuntu 14.04 on NVidia GeForce GTX 560 Ti, Windows 7 on NVidia GeForce GTX 775M, and OSX 10.10 on NVidia GeForce GTX 775M. \n * If you have a CUDA compatible card with the above operating systems, and are experiencing issues, please contact the repository owners.\n * Windows: You will need Microsoft Visual Studio 2013 build tools. This document describes the \"NMake\" process.\n * OSX: Please be sure to follow setup for CUDA \u003ca href=\"http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-mac-os-x/#axzz3W4nXNNin\"\u003ehere\u003c/a\u003e. There are several compatability requirements for different MAC machines, including using a different version of CUDA (ie. 5.5).\n\nBuilding\n==============\n\n\u003ch3\u003eLinux and OSX\u003c/h3\u003e\nIn a terminal:\n```c++\nmkdir SCI-SOLVER_FEM/build\ncd SCI-SOLVER_FEM/build\ncmake ../src\nmake\n```\n\n\u003ch3\u003eWindows\u003c/h3\u003e\nOpen a Visual Studio (32 or 64 bit) Native Tools Command Prompt. \nFollow these commands:\n```c++\nmkdir C:\\Path\\To\\SCI-Solver_FEM\\build\ncd C:\\Path\\To\\SCI-Solver_FEM\\build\ncmake -G \"NMake Makefiles\" ..\\src\nnmake\n```\n\n**Note:** For all platforms, you may need to specify your CUDA toolkit location (especially if you have multiple CUDA versions installed):\n```c++\ncmake -DCUDA_TOOLKIT_ROOT_DIR=\"~/NVIDIA/CUDA-7.0\" ../src\n```\n(Assuming this is the location).\n\n**Note:** If you have compile errors such as \u003ccode\u003eundefined reference: atomicAdd\u003c/code\u003e, it is likely you need to set your compute capability manually. CMake outputs whether compute capability was determined automatically, or if you need to set it manually. The default (and known working) minimum compute capability is 2.0.\n\n```c++\ncmake -DCUDA_COMPUTE_CAPABILITY=20 ../src\nmake\n```\n\n\nRunning Examples\n==============\n\nYou will need to enable examples in your build to compile and run them\n\n```c++\ncmake -DBUILD_EXAMPLES=ON ../src\nmake\n```\n\nYou will find the example binaries built in the \u003ccode\u003ebuild/examples\u003c/code\u003e directory.\n\nRun the examples in the build directory:\n\n```c++\nexamples/Example1\nexamples/Example2\n...\n```\nEach example has a \u003ccode\u003e-h\u003c/code\u003e flag that prints options for that example. \u003cbr/\u003e\n\nFollow the example source code in \u003ccode\u003esrc/examples\u003c/code\u003e to learn how to use the library.\n\u003cbr/\u003e\nTo run examples similar to the paper, the following example calls would do so:\u003cbr/\u003e\n\u003cb\u003e2D FEM, Egg Carton \u003c/b\u003e\u003cbr/\u003e\n\u003ccode\u003eexamples/Example2 -v -i ../src/test/test_data/simple.ply -A \"../src/test/test_data/simpleTri.mat\" -b \"../src/test/test_data/simpleTrib.mat\"\u003c/code\u003e\u003cbr/\u003e\n\n**NOTE** All examples output a set of \u003ccode\u003eresult.vtk\u003c/code\u003e (name based off input \nfilename) VTK files in the current directory. These files are easily viewed via VTK readers like Paraview.\nYou can clip and add iso-values to more distinctly visualize the result. An \u003ccode\u003eoutput.mat\u003c/code\u003e\nMATLAB file is also written to file (solution coefficients).\n\nUsing the Library\n==============\n\nA basic usage of the library links to the \u003ccode\u003elibFEM_CORE\u003c/code\u003e library during build and \nincludes the headers needed, which are usually no more than:\n\n```c++\n#include \"FEMSolver.h\"\n```\n\nThen a program would setup the FEM parameters using the \n\u003ccode\u003e\"FEMSolver object\"\u003c/code\u003e object and call\n\u003ccode\u003eobject.solveFEM()\u003c/code\u003e to generate\nthe answer matrices.\n\nHere is a minimal usage example (using a tet mesh).\u003cbr/\u003e\n```c++\n#include \u003cFEMSolver.h\u003e\nint main(int argc, char *argv[])\n{\n  //the filename in the constructor below means ~/myTetMesh.node \u0026 ~/myTetMesh.ele\n  FEMSolver data(\"~/myTetMesh\", false, true); // tet mesh, not a tri mesh, and verbose\n  //read in your Matrices (A matrix object is a member of FEMSolver)\n  data.readMatlabSparseMatrix(\"~/A_MATRIX.mat\");\n  Vector_h_CG b_h(cfg.getMatrixRows(), 1.0);\n  data.readMatlabArray(\"~/b_array.mat\", \u0026b_h)\n  //The answer vector.\n  Vector_h_CG x_h(cfg.getMatrixRows(), 0.0);\n  //Run the solver\n  data.solveFEM(\u0026x_h, \u0026b_h);\n  //now use the result\n  data.writeMatlabArray(\"outputName.mat\", x_h);\n  //write the VTK\n  std::vector\u003cdouble\u003e vals;\n  for (size_t i = 0; i \u003c x_h.size(); i++){\n    vals.push_back(x_h[i]);\n  }\n  data.writeVTK(vals, \"outputName\");\n  return 0;\n}\n```\n\nYou can access the A matrix and meshes directly:\n```c++\nTetMesh * FEMSolver::tetMesh_;\nTriMesh * FEMSolver::triMesh_;\n```\n\n\u003ch3\u003eFEM Solver Parameters\u003c/h3\u003e\n\n```C++\n  class FEMSolver {\n\t  bool verbose_;                  // output verbosity\n\t  std::string filename_;          // mesh file name\n\t  int maxLevels_;                 // the maximum number of levels\n\t  int maxIters_;                  // the maximum solve iterations\n\t  int preInnerIters_;             // the pre inner iterations for GSINNER\n\t  int postInnerIters_;            // the post inner iterations for GSINNER\n\t  int postRelaxes_;               // the number of post relax iterations\n\t  int cycleIters_;                // the number of CG iterations per outer iteration\n\t  int dsType_;                    // data structure type\n\t  int topSize_;                   // max size of coarsest level\n\t  int randMisParameters_;         // max size of coarsest level\n\t  int partitionMaxSize_;          // max size of of the partition\n\t  int aggregatorType_;            // aggregator oldMis (0), metis bottom up (1), \n\t\t\t\t\t\t\t\t\t  //   metis top down (2), aggMisGPU (3), aggMisCPU (4), newMisLight (5)\n\t  int convergeType_;              // the convergence tolerance algorithm \u003cabsolute (0)|relative (1)\u003e\n\t  double tolerance_;              // the convergence tolerance\n\t  int cycleType_;                 // the cycle algorithm \u003cV (0) | W (1) | F (2) | K (3)\u003e\n\t  int solverType_;                // the solving algorithm \u003cAMG (0) | PCG (1)\u003e\n\t  double smootherWeight_;         // the weight parameter used in a smoother\n\t  double proOmega_;               // the weight parameter used in prolongator smoother\n\t  int device_;                    // the GPU device number to specify\n\t  int blockSize_;\n      ...\n  };\n```\n\u003cbr/\u003e\nYou will need to make sure your CMake/Makfile/Build setup knows where \nto point for the library and header files. See the examples and their CMakeLists.txt.\u003cbr/\u003e\u003cbr/\u003e\nTesting\n==============\nThe repo comes with a set of regression tests to see if recent changes break\nexpected results. To build the tests, you will need to set\n\u003ccode\u003eBUILD_TESTING\u003c/code\u003e to \"ON\" in either \u003ccode\u003eccmake\u003c/code\u003e or when calling CMake:\n\n```c++\ncmake -DBUILD_TESTING=ON ../src\n```\nAfter building, run \u003ccode\u003emake test\u003c/code\u003e or \u003ccode\u003ectest\u003c/code\u003e in the build directory to run tests.\u003cbr/\u003e\n\u003ch4\u003eWindows\u003c/h4\u003e\nThe gtest library included in the repo needs to be built with \nforced shared libraries on Windows, so use the following:\n\n```c++\ncmake -DBUILD_TESTING=ON -Dgtest_forced_shared_crt=ON ../src\n```\nBe sure to include all other necessary CMake definitions as annotated above.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsciinstitute%2Fsci-solver_fem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsciinstitute%2Fsci-solver_fem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsciinstitute%2Fsci-solver_fem/lists"}