Looking for sample project in plain C

Hi all,

yes, there are so many projects running under Linux that come along with source.
On the other hand, probably I’m about to miss the forest for the trees.

I once wrote a Finite Element computer program to run under MacOS 8/9,
using only a command line interface (MPW).

Now I would like to port that code - which doesn’t rely on special hardware.

The source code is plain C - I don’t speak C++ (etc.).

It would help me to see an example of how to build and link libraries under Linux
from plain C source, in order to get a working program.

As a next step - not necessarily the same project - it would help me to have
a look at a project, in which use of parallel execution on several processors/cores
has been made - at best a program that as well is written in plain C.

Thank you !
Mike

There are numerous tutorials online. Just a couple to get you started:

GCC and Make - A Tutorial on how to compile, link and build C/C++ applications

An Introduction to GCC - Compiling a simple C program

Hi deano_ferrari,

thank you for the 1st link.
I already searched for online tutorials on the web, but that one isn’t bad.

However, that one still doesn’t seem to explain/demonstrate how to build a library (instead of just linking it).

Look, for the Finite Element program I wrote, I even coded my own BLAS (Basic Linear Algebra System).

I coded static arrays of pointers to functions within those BLAS routines,
although this isn’t a component / excluded in ANSI C Standard
(it still is possible using type casts for pointers).

What I need is indeed a bit more than “Hello World”.

Still, further, I would appreciate very much to get a link to a project with code written in plain C
that makes use of programming parallel execution of code (i.e. running threads in parallel on the several
cores of my processor to e.g. speed up the numerical solution of a matrix equation),
so I could play around with that, and use it as a template.

Thanks
Mike

I mean, the Linpack benchmark is something that uses parallel programming,
but that one is written in FORTRAN.

I haven’t had experience with parallel programming, but openMP is a multi-threading implementation of interest here. The following might give you the background and examples to get going

A2. Parallel Programming in C

OpenMP - Wikipedia, the free encyclopedia

https://docs.loni.org/wiki/Introduction_to_OpenMP

Good luck :slight_smile:

Dear deano_ferrari,

the pages that can be accessed by these links look very promising,
and these pages even include further links to parallel programming.

This is really helpful !

Thank you indeed :wink:
Mike

My pleasure Mike. Maybe, when you’re further down the track with your project, you’ll share your adventure with us. :slight_smile:

ratzi wrote:
> I once wrote a Finite Element computer program to run under MacOS 8/9,
> using only a command line interface (MPW).
>
> Now I would like to port that code - which doesn’t rely on special
> hardware.

Sounds like an interesting project.

> It would help me to see an -example- of how to build and link
> libraries under Linux
> from plain C source, in order to get a working program.
>
> As a next step - not necessarily the same project - it would help me to
> have
> a look at a project, in which use of parallel execution on several
> processors/cores
> has been made - at best a program that as well is written in plain C.

Just for giggles.

The canonical example of what you’ve just described is … the Linux
kernel :slight_smile:

There’s a fair amount of documentation about, I believe, but it’s
possibly not the best example to start with :stuck_out_tongue_winking_eye:

Hi deano_ferrari,

OK, but that may take a while, because porting that code isn’t my only task, currently.

First I will have to get that code running under Linux (here openSUSE).
After all my experience, having code running is the basis for anything further.

That in addition would provide a basis for comparisons of performance
(single thread vs. parallel execution).

Probably I’ll report in a new thread if I succeed.

Best wishes
Mike

Hi djh-novell,

yes, the kernel has to and will implement parallel programming.

But I didn’t want to read (and understand) that much lines of code. So you’re right with

I looked for a template, for something simplier :slight_smile:
Thank you
Mike

A famous site for numerical software not only in C is:
The Netlib

A Finite Element Program in C can be found here:
FElt: introductory finite element analysis
That once was hosted on cs.ucsd.edu .

Links to other Internet Finite Element resources (free an non-free) are here:
Internet Finite Element Resources

A 12 year old list of free numerical software in C/C++ including descriptions is here:
http://www.netlib.org/c/numcomp-free-c

Links to meshing resources are here:
Mesh Generation and Grid Generation: Software

Many of the projects accessible through these links are a bit older,
so examples for parallel programming might only be found scarcely
following these links.
However, the maths that form the background didn’t change.

FontForge looks as a good C project including makefiles for libraries - I’m not
a newcomer to C, but I never compiled under Linux until present, sorry.
Anyway, I don’t want to invent the wheel again lol!

In addition, FontForge is a nice program helping to improve or to even create new fonts.