Go to content ALT+c

Parallel Programming on Multicore Computers with OpenMP  (Jun. 2020) (Old site; new site is at https://scinet.courses)

Thursday May 23, 2024 - 00:46
Reply
  • compiling problem when play with the False sharing example

      Thu Jun 25 02:13

    Dear All,

    When I try to understand the False sharing concept and play with the example in the lecture, I can't compile it, neither on my Mac nor on the teach cluster.

    The error message is as follows:

    (base) ➜ OpenMP101 gcc-9 -fopenmp FalseSharing.c
    FalseSharing.c: In function 'main':
    FalseSharing.c:5:11: error: 'new' undeclared (first use in this function)
    5 | int *x = new int[100];
    | ^~~
    FalseSharing.c:5:11: note: each undeclared identifier is reported only once for each function it appears in
    FalseSharing.c:5:15: error: expected ',' or ';' before 'int'
    5 | int *x = new int[100];
    | ^~~
    FalseSharing.c:14:2: error: 'delete' undeclared (first use in this function)
    14 | delete [] x;
    | ^~~~~~
    FalseSharing.c:14:10: error: expected expression before ']' token
    14 | delete [] x;
    | ^

    I am not familiar with C, so can anyone give me some help on this?

    Best,
    Yao

 

  • You must be logged in to post.


Content Navigation


Course Calendar


Forum Posts


Related



Questions? Contact Support.
Web site engine's code is copyright © ATutor®.
Modifications and code of added modules are copyright of SciNet.