From 32d633bfb6dc8dc7f7be791931285417aab8c99a Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 15 Oct 2020 12:36:52 +0200 Subject: [PATCH] Fixed type in free --- TODO.org | 12 ++++++++++++ src/Makefile | 5 +++-- src/qmckl_context.org | 16 ++++++++++------ 3 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 TODO.org diff --git a/TODO.org b/TODO.org new file mode 100644 index 0000000..2d5626b --- /dev/null +++ b/TODO.org @@ -0,0 +1,12 @@ +* Set up CI on Travis +* Write tests + +* malloc/free : Parameters for accelerators? +We should define qmckl_malloc and qmckl_free just to give the +possibility of the HPC implementations to define how they allocate the +memory (on CPU or GPU, using alternatives to malloc/free, etc). +A possibility could be to pass the id of a NUMA domain as a parameter of +qmckl_malloc, where the domain id is something obtained from the +context. + + diff --git a/src/Makefile b/src/Makefile index 293255a..9255ca0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,8 +1,9 @@ CC=gcc -CFLAGS= +CFLAGS=-fexceptions -Wall -Werror -Wpedantic -Wextra FC=gfortran -FFLAGS= +FFLAGS=-fcheck=all -Waliasing -Wampersand -Wconversion -Wsurprising -Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation -Wreal-q-constant -Wuninitialized -fbacktrace -ffpe-trap=zero,overflow,underflow -finit-real=nan + ORG_SOURCE_FILES=qmckl_context.org OBJECT_FILES=$(patsubst %.org,%.o,$(ORG_SOURCE_FILES)) diff --git a/src/qmckl_context.org b/src/qmckl_context.org index b24f7f0..255b2dc 100644 --- a/src/qmckl_context.org +++ b/src/qmckl_context.org @@ -97,18 +97,22 @@ qmckl_context qmckl_context_copy(const qmckl_context context) { implying that the context has been freed. #+BEGIN_SRC C :tangle qmckl_context.h -qmckl_context qmckl_context_destroy(qmckl_context context); +int qmckl_context_destroy(qmckl_context context); #+END_SRC #+BEGIN_SRC C :tangle qmckl_context.c -qmckl_context qmckl_context_destroy(qmckl_context context) { +int qmckl_context_destroy(qmckl_context context) { - if (context == NULL) { - return (qmckl_context) 0; + qmckl_context_struct* ctx; + + ctx = (qmckl_context_struct*) context; + + if (ctx == NULL) { + return 0; } - free(context); - return (qmckl_context) 1; + free(ctx); + return 1; } #+END_SRC