Skip to content

Commit

Permalink
changes for building wheel.
Browse files Browse the repository at this point in the history
  • Loading branch information
manoskary committed Jul 18, 2024
1 parent 303be54 commit f41017b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 7 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

ext_modules = [
setuptools.Extension(
name="graphmuse.samplers.csamplers", sources=[os.path.join(os.path.dirname(__file__), "src", "gmsamplersmodule.c")],
extra_link_args = [], include_dirs=[os.path.join(numpy.get_include(), "numpy"), "include"])]
name="graphmuse.samplers.csamplers", sources=["src/gmsamplersmodule.c"],
extra_link_args = [], include_dirs=[numpy.get_include(), "include"])]

# os.environ["CC"] = "gcc"
# os.environ["CXX"] = "gcc"
Expand Down
38 changes: 33 additions & 5 deletions src/gmsamplersmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#define PY_ARRAY_UNIQUE_SYMBOL sam_ARRAY_API
#include <ndarraytypes.h>
#include <ndarrayobject.h>
// #include <numpy/arrayobject.h>
#include <numpy/ndarraytypes.h>
//#include <ndarrayobject.h>
#include <numpy/arrayobject.h>


#define MACRO_MAX(a,b) ((a)<(b))? (b) : (a)
Expand Down Expand Up @@ -38,10 +38,38 @@ typedef Node EdgeType;
#define Node_To_Index(n) ((Index)(n))
#define Index_To_Node(i) ((Node)(i))

#ifndef GM_DEBUG_OFF
#define ASSERT_POW2(N){ \
Key ASSERT_POW2_N = N; \
Key ASSERT_POW2_BIT_COUNTER=0; \
while(ASSERT_POW2_N>0){ \
ASSERT_POW2_BIT_COUNTER+=(Key)(ASSERT_POW2_N&1); \
ASSERT_POW2_N>>=1; \
} \
ASSERT(ASSERT_POW2_BIT_COUNTER==1); \
}
#endif

#define MOD_POW2(K, P2) ((K)&(P2-1))

// taken from here https://barrgroup.com/embedded-systems/how-to/define-assert-macro

#ifndef GM_DEBUG_OFF
#define ASSERT(expr) \
if(expr)\
{}\
else{\
printf("Assertion failed in %s at line %d\n>>\t%s\t<<\n", __FILE__, __LINE__, #expr); \
abort(); \
}
#endif

#ifdef GM_DEBUG_OFF
#define ASSERT(expr){}
#endif

#include <utils.c>
#include <GM_assert.h>
//#include <utils.c>
//#include <GM_assert.h>
#ifdef Thread_Count_Arg
#include <mt.c>
#include <threadpool.c>
Expand Down

0 comments on commit f41017b

Please sign in to comment.