Custom Functors in C++ #2489
-
#include <souffle/SouffleInterface.h>
#include <iostream>
extern "C" {
souffle::RamDomain insert(souffle::SymbolTable* symbolTable, souffle::RecordTable* recordTable,
souffle::RamDomain name, souffle::RamDomain type, souffle::RamDomain map) {
assert(symbolTable && "NULL symbol table");
assert(recordTable && "NULL record table");
if (map != 0) {
const souffle::RamDomain* cur_map = recordTable->unpack(map, 3);
if (cur_map == 0) {
return map;
}
souffle::RamDomain cur_name = cur_map[0];
souffle::RamDomain cur_type = cur_map[1];
souffle::RamDomain next_map_packed = insert(symbolTable, recordTable, name, type, cur_map[2]);
souffle::RamDomain new_map[3] = {cur_name, type, next_map_packed}; // simply replace the type field in this new map
return recordTable->pack(new_map, 3);
}
return map;
}
} This is my current implementation of a function that simply replaces the type field with the argument
This is how I call the function. But when I run this souffle program, I get this error:
I already tried to figure out why this happens here: But to no avail. What am I doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Hi, It looks like the sort of error that happens when either Souffle or the functor do not have OpenMP enabled, but it may be something else as well. |
Beta Was this translation helpful? Give feedback.
-
Yes thank you so much for the quick response! I compile my functor with this: g++ -std=c++17 functors.cpp -c -fPIC -fopenmp -o functors.o
g++ -shared -o libfunctors.so functors.o
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}`pwd` This is my output for souffle --version:
|
Beta Was this translation helpful? Give feedback.
-
Did you build Soufflé or did you installed it somehow? Are you using headers from the same sources/build ? I don't see a Can you share the souffle run command? Do you get any output before the crash? |
Beta Was this translation helpful? Give feedback.
Since
souffle
is built withWord size: 64 bits
, you need to pass-DRAM_DOMAIN_SIZE=64
.