Showing posts with label Eclipse. Show all posts
Showing posts with label Eclipse. Show all posts

Saturday, September 19, 2015

Configuring PETSc and Eclipse Parallel Tools Platform (PTP) on macOS and Linux (C++ / Fortran)

The PETSc (Portable, Extensible Toolkit for Scientific Computation) framework provides high-performance data structures, sparse matrix operations, and scalable linear/nonlinear solvers for finite element and scientific modeling. Setting up PETSc within the Eclipse Parallel Tools Platform (PTP) IDE simplifies debugging and cross-compilation across macOS and Linux.

Platforms Verified: macOS Yosemite • Ubuntu 14.04 LTS • CentOS / RHEL (OpenMPI) • C++ and Fortran Compilers

1. Building PETSc with OpenMPI

Configure PETSc with shared libraries and debugging enabled:

./configure --with-shared-libraries=1 --with-debugging=1 PETSC_ARCH=debug
make PETSC_DIR=/path/to/petsc PETSC_ARCH=debug all
make PETSC_DIR=/path/to/petsc PETSC_ARCH=debug test

2. Eclipse Project Configuration

  1. Environment Variables: In Project Properties → C/C++ Build → Environment, add:
    • PETSC_DIR: Absolute path to your PETSc root directory.
    • PETSC_ARCH: Set to debug for Debug configurations and release for Release.
  2. Include Paths: Under C/C++ General → Paths and Symbols → Includes:
    ${PETSC_DIR}/include
    ${PETSC_DIR}/${PETSC_ARCH}/include
  3. Linker Libraries & Path: Under C/C++ Build → Settings → Linker:
    • Libraries (-l): Add petsc
    • Library search path (-L): Add ${PETSC_DIR}/${PETSC_ARCH}/lib
    • Miscellaneous Linker flags: Add runtime path binding:
      -Wl,-rpath,"${PETSC_DIR}/${PETSC_ARCH}/lib"
  4. Fortran Preprocessing Flags: If using gfortran, navigate to Fortran Build → Settings → Miscellaneous and add:
    -cpp -dM

3. Verification Test (C++)

#include <iostream>
#include "petsc.h"

int main(int argc, char *argv[]) {
    PetscInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL);
    PetscPrintf(PETSC_COMM_WORLD, "PETSc successfully initialized in Eclipse!
");
    PetscFinalize();
    return 0;
}

How Google Antigravity Solved the Mysterious NVIDIA Sleep Reboot on My Dell Inspiron 7567 (Ubuntu Linux)

If you run modern Ubuntu or Linux on a Dell Inspiron 15 Gaming (7567) or a similar 7th-gen Intel laptop paired with an NVIDIA GeForce GTX ...