Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • openfpm_pdata openfpm_pdata
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Sbalzarini Lab
    • SSoftware
    • PParallel Computing
  • OpenFPM
  • openfpm_pdataopenfpm_pdata
  • Wiki
  • OpenFPM pdata examples

Last edited by rundeck Dec 11, 2015
Page history

OpenFPM pdata examples

Examples

The examples can be downloaded here

In order to compile the examples, go into your OpenFPM installation root folder and copy the file

openfpm_pdata/include/example.mk

in the root folder (where you decompress the tar.gz) of the examples. To compile the examples do

make

The examples are grouped by data structure, each folder has a set of examples, the number is progressive based on level of complexity. The Makefile inside each example is simple to follow and can be used as a starting point to create your own makefile

Makefile

OpenFPM installation process generate automatically the file example.mk that file contain include paths information, library path information and linking libraries required in order to compile any project that use OpenFPM

INCLUDE_PATH=-I. -I/usr/local/openfpm_pdata/include/config -I/usr/local/openfpm_pdata/include -I/usr/local/openfpm_data/include -I/usr/local/openfpm_vcluster/include -I/usr/local/openfpm_io/include -I/usr/local/openfpm_devices/include -I/home/i-bird/METIS/include
LIBS_PATH=-L/usr/local/openfpm_devices/lib -L/usr/local/openfpm_vcluster/lib -L/home/i-bird/METIS/lib 
LIBS=-lvcluster -lofpmmemory -lmetis -lboost_iostreams

Define this a simple Makefile is

include ../../example.mk

CC=mpic++

OBJ = main.o

%.o: %.cpp
	$(CC) -O3 -c --std=c++11 -o $@ $< $(INCLUDE_PATH)

grid: $(OBJ)
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)

all: grid

.PHONY: clean all

clean:
	rm -f *.o *~ core grid

CC=mpic++ define the compiler OBJ= define the intermediate files that must be created by compilation before linking ( For example if you have a project composed by file.cpp main.cpp client.cpp you use

OBJ = file.o main.o client.o

The following of the Makefile define rules and dependencies

%.o: %.cpp
	$(CC) -O3 -c --std=c++11 -o $@ $< $(INCLUDE_PATH)

Is a rule that define how to produce a .o file from a .cpp, basically how to compile a .cpp file

grid: $(OBJ)
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)

Is a rule that define a to produece the final executable, basically how to produce the executable from all the produce .o files

all: grid

Is the default rule when we use the make, this rule call the others in a nested way The last rule clean, is a way to remove binary and .o files, we remark that the make file is conservative if it find that the executable is already created Makefile is not going to re-create it

clean:
	rm -f *.o *~ core grid

If we have a rule "clean: " the default behaviour of the make file is to check if a file called clean exist and only in case does not exist issue the command

.PHONY: clean all

override this functionality specifying that "clean" and "all" are just rules name without underling file

Clone repository
  • CartDecomposition
  • Decomposition
  • Directories
  • Examples
  • Home
  • Install
  • OpenFPM pdata advanced options
  • OpenFPM pdata examples
  • Update
  • grid dist id
  • Home