Quantcast
Channel: Recent posts
Viewing all articles
Browse latest Browse all 19

Using Offload in Dynamic Shared Library for Postgres

$
0
0

Hello!

I need to compile user defined functions in C language for Postgres. These functions may offload some work to MIC.

The problem is that Postgres drop session on any #pragma offload.

I make minimal example. I made a simple DSO library, simple direct call tester and testing with Postgres (in attachments).

I use next compilation commands:

CC=icc 
CFLAGS=-Wall -openmp 
PG_PATH_BIN=/storage/home/xxx/postgresql-9.1.9-build/bin
PG_SERVER_INCLUDE_DIR_PATH=-I`$(PG_PATH_BIN)/pg_config --includedir-server`
SO_FLAG=-shared
$(CC) $(CFLAGS) $(SO_FLAG) $(PG_SERVER_INCLUDE_DIR_PATH) -fPIC pgMIC.c -o libpgMIC.so
$(CC) exec.o -L. -lpgMIC -o exec.out

exec.out returns: add_one1(5) = 11

Postgres psql call returns:
postgres=# CREATE FUNCTION add_one(integer) returnS integer AS 'libpgMIC', 'add_one' LANGUAGE C STRICT;
CREATE FUNCTION
postgres=# SELECT add_one(5);
The connection to the server was lost. Attempting reset: Succeeded

Postgres log shows: LOG:  server process (PID 25489) was terminated by signal 11: Segmentation fault

If I comment out #pragma offload Postgres is OK.

Can anybody give some advice what is the problem, how to get more information about segmentation fault reason? Maybe I forgot some compile options?


Viewing all articles
Browse latest Browse all 19

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>