-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
Not sure if I am doing anything wrong or if some small changes are needed to the linux_gnu.def
or to vadd_heap.c
file:
$ git rev-parse HEAD
742cab2e84c164fe67ddc023e8421121e517e791
$ git st
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: make.def
#
no changes added to commit (use "git add" and/or "git commit -a")
$ diff -s make.def Make_def_files/linux_gnu.def
Files make.def and Make_def_files/linux_gnu.def are identical
$ gcc --version
gcc (GCC) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ make
g++ -fopenmp -O3 -c pi.c
g++ -fopenmp -O3 -o pi pi.o -lm
g++ -fopenmp -O3 -c jac_solv.c
g++ -fopenmp -O3 -c mm_utils.c
g++ -fopenmp -O3 -o jac_solv jac_solv.o mm_utils.o -lm
g++ -fopenmp -O3 -c vadd.c
g++ -fopenmp -O3 -o vadd vadd.o -lm
g++ -fopenmp -O3 -c vadd_heap.c
vadd_heap.c: In function ‘int main()’:
vadd_heap.c:14:18: error: ‘malloc’ was not declared in this scope
14 | float *a = malloc(sizeof(float) * N);
| ^~~~~~
vadd_heap.c:3:1: note: ‘malloc’ is defined in header ‘<cstdlib>’; did you forget to ‘#include <cstdlib>’?
2 | #include <omp.h>
+++ |+#include <cstdlib>
3 | #define N 100000
vadd_heap.c:41:4: error: ‘free’ was not declared in this scope
41 | free(a);
| ^~~~
vadd_heap.c:41:4: note: ‘free’ is defined in header ‘<cstdlib>’; did you forget to ‘#include <cstdlib>’?
make: *** [vadd_heap.o] Error 1
On the other hand, building with https://developer.nvidia.com/hpc-sdk aka PGI (see below for version) works as intended
$ pgcc --version
pgcc (aka nvc) 20.11-0 LLVM 64-bit target on x86-64 Linux -tp skylake
PGI Compilers and Tools
Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
Metadata
Metadata
Assignees
Labels
No labels