new release / major qcc update

795 views
Skip to first unread message

Stephane Popinet

unread,
Jun 11, 2022, 4:29:02 AM6/11/22
to basilisk-fr
Dear all,

I have just released a new version with a major update/rewrite of the
Basilisk C preprocessor (qcc).

This is a complete rewrite with a proper grammar, see here if you are
interested in the details:

http://basilisk.fr/src/ast/README

The most visible improvement for the moment is a much more robust
implementation of automatic boundaries, which should avoid most of the
problems reported with the previous version.

In the long run this new implementation allows for much more powerful
code transformations. This is important in particular for automatic code
generation on GPUs.

Please test and report any problems.

Enjoy,

Stephane

Stephane Popinet

unread,
Jun 13, 2022, 6:10:22 AM6/13/22
to basilisk-fr, MORHAF ALJBER
Hi Morhaf,

Use rather:

% make -k clean
% make -k
% make -k

cheers,

Stephane

On 6/13/22 11:33, MORHAF ALJBER wrote:
> Dear Prof.Stephane,
>
> I update the basilisk code and when and recompiled using "make clean" I
> received the following error.
>
> cc -O2 -g -Wall -pipe -D_FORTIFY_SOURCE=2 -DDUMBGL
>  /home/morhaf/basilisk/src/qcc.c   -o /home/morhaf/basilisk/src/qcc
> /home/morhaf/basilisk/src/qcc.c: In function ‘main’:
> /home/morhaf/basilisk/src/qcc.c:124:22: error: ‘CC99’ undeclared (first
> use in this function)
>   124 |     strcpy (command, CC99);
>       |                      ^~~~
> /home/morhaf/basilisk/src/qcc.c:124:22: note: each undeclared identifier
> is reported only once for each function it appears in
> /home/morhaf/basilisk/src/qcc.c:166:26: error: ‘CADNACC’ undeclared
> (first use in this function)
>   166 |         strcpy (command, CADNACC);
>       |                          ^~~~~~~
> /home/morhaf/basilisk/src/qcc.c:330:34: error: ‘CPP99’ undeclared (first
> use in this function)
>   330 |       if (!cppcommand && strcmp (CPP99, ""))
>       |                                  ^~~~~
> /home/morhaf/basilisk/src/qcc.c:360:24: error: ‘BASILISK’ undeclared
> (first use in this function)
>   360 |       strcat (preproc, BASILISK);
>       |                        ^~~~~~~~
> /home/morhaf/basilisk/src/qcc.c:363:24: error: ‘LIBDIR’ undeclared
> (first use in this function)
>   363 |       strcat (preproc, LIBDIR);
>       |                        ^~~~~~
> make: *** [<builtin>: /home/morhaf/basilisk/src/qcc] Error 1
>
> Best regards,
> Morhaf
>
>
> On Saturday, June 11, 2022 at 5:29:02 PM UTC+9 Stephane Popinet wrote:
>
> Dear all,
>
> I have just released a new version with a major update/rewrite of the
> Basilisk C preprocessor (qcc).
>
> This is a complete rewrite with a proper grammar, see here if you are
> interested in the details:
>
> http://basilisk.fr/src/ast/README <http://basilisk.fr/src/ast/README>

Russel Morison

unread,
Jun 13, 2022, 7:35:20 AM6/13/22
to Stephane Popinet, basilisk-fr, MORHAF ALJBER
Hi Stephane et al.,
                            I got the same error messages as Morhaf, and continued to get c99 error messages (when doing make -k) which caused the code to not compile.
I did a crude fix by adding the -std=c99 option to the CFLAGS line in the config.gcc file, so it now looks like:
CFLAGS += -std=c99 -pedantic -g -Wall -pipe -D_FORTIFY_SOURCE=2

This seemed to solve the problems as gcc then always used the c99 option.
I am using centos 7.9, gcc version 4.8.5 .

thanks,
          Russel Morison.
School of Mathematics & Statistics
The University of New South Wales
Sydney, Australia, 2052.

--
You received this message because you are subscribed to the Google Groups "basilisk-fr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to basilisk-fr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/basilisk-fr/7a51d5b5-3ea2-73ea-264c-0e202a0dade8%40basilisk.fr.

Stephane Popinet

unread,
Jun 13, 2022, 8:23:16 AM6/13/22
to basil...@googlegroups.com
Hi Russel,

Thanks for the feedback and fix.

> This seemed to solve the problems as gcc then always used the c99 option.
> I am using centos 7.9, gcc version 4.8.5 .

Please note that gcc 4.8.5 was released in 2015. It would probably be a
good idea to update it...

cheers,

Stephane

Bradley Boyd

unread,
Jun 13, 2022, 11:39:23 AM6/13/22
to basilisk-fr
Hello Stephane

Thanks for the update!

I got a large number of errors when compiling the new version starting with 

 ast.c: In function ‘ast_parse_expression’:
 ast.c:650:28: error: ‘sym_statement’ undeclared (first use in this function)
   650 |     Ast * c = ast_find (n, sym_statement);


Attached are all the errors I got (GCC 9.4.0)

Kind regards

Bradley
loglog2

Stephane Popinet

unread,
Jun 13, 2022, 11:56:09 AM6/13/22
to basil...@googlegroups.com
Hi Bradley,

> I got a large number of errors when compiling the new version starting with
> /
> /
> / ast.c: In function ‘ast_parse_expression’:
>  ast.c:650:28: error: ‘sym_statement’ undeclared (first use in this
> function)
>    650 |     Ast * c = ast_find (n, sym_statement);
Try:

cd $BASILISK/ast/
darcs revert -a .
cd $BASILISK
make -k
make -k

Stephane

Wachs, Anthony

unread,
Jun 13, 2022, 12:57:55 PM6/13/22
to Stephane Popinet, basil...@googlegroups.com

Dear Russel,

We had the same problem 3 years ago with a much older version of Basilisk on a CentOS 7 system. See https://groups.google.com/g/basilisk-fr/c/3-FyvudM02g/m/x6YS2eH7EgAJ

We used the same fix as yours. Therefore I presume that the problem is not related to the new version of Basilisk but to the Linux OS you are running Basilisk on.

Best wishes,

Anthony


--
Anthony Wachs, Professor
Departments of Mathematics and Chemical & Biological Engineering
University of British Columbia
Vancouver, BC, Canada
e-mail: wa...@math.ubc.ca / wa...@mail.ubc.ca
Tel: +1-604-822-4346



From: basil...@googlegroups.com <basil...@googlegroups.com> on behalf of Stephane Popinet <pop...@basilisk.fr>
Sent: Monday, June 13, 2022 5:23 AM
To: basil...@googlegroups.com
Subject: Re: new release / major qcc update
 
[CAUTION: Non-UBC Email]
--
You received this message because you are subscribed to the Google Groups "basilisk-fr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to basilisk-fr...@googlegroups.com.

MORHAF ALJBER

unread,
Jun 14, 2022, 1:46:18 AM6/14/22
to Stephane Popinet, basilisk-fr
Dear Prof. stephan

Thank you for your reply.
The recompilation problem was solved using "make -k" and there was no need to modify anything else.
I'm using Ubuntu 22.04.

Best regards,
Morhaf

j.a.v...@gmail.com

unread,
Jun 30, 2022, 5:23:41 AM6/30/22
to basilisk-fr
Hallo Stephane,

I did some tests and found a few changes in qcc that breaks my code. I
can image the code was already broken but old qcc did not care. So it
would be good to know if the following is a `feature`.

1) Iterating over a list inside a foreach loop may cause confusion for
qcc. I made a bug report: www.basilisk.fr/sandbox/bugs/lists.c

2) Using "foreach_dimension()" inside a `@def`inition of a
foreach_MY_ITERATOR() is not possible anymore. Compiler error:
"foreach_dimension() not defined", indicating that is does not get
expanded as it used to be. E.g. `foreach_ray()` in

3) Optional argument structures cannot be `typedef`ed anymore. E.g.

typedef struct a {
 int a;
} a;

int self (struct a args) {
   return args.a;
}

4) Arguments to foreach_loops only sometimes need to be separated by
a comma. E.g.:

double a = 0, b = 0;
foreach_face (x reduction(+:a) reduction(+:b)) {
         a += x;
         b += y;
}

requires only 1 comma ( `x redu...` -> `x, redu...` ). I believe it was
fully optional in the past (which was also confusing).

Antoon

Op dinsdag 14 juni 2022 om 07:46:18 UTC+2 schreef morhaf...@gmail.com:

Stephane Popinet

unread,
Jul 5, 2022, 8:11:12 AM7/5/22
to basil...@googlegroups.com
Hi Antoon,

Thanks for the feedback.

> 1) Iterating over a list inside a foreach loop may cause confusion for
> qcc. I made a bug report: www.basilisk.fr/sandbox/bugs/lists.c

This is indeed a bug, which I have just fixed.

> 2) Using "foreach_dimension()" inside a `@def`inition of a
> foreach_MY_ITERATOR() is not possible anymore. Compiler error:
> "foreach_dimension() not defined", indicating that is does not get
> expanded as it used to be. E.g. `foreach_ray()` in
> basilisk.fr/sandbox/Antoonvh/bwatch-iterators.h

This is a "feature" of the new code (or more honestly a known
regression). I will fix this eventually. In the meantime, you can work
around this by expanding foreach_dimension() manually. See here for an
example:

http://basilisk.fr/src/utils.h#339

> 3) Optional argument structures cannot be `typedef`ed anymore. E.g.
>
> typedef struct a {
>  int a;
> } a;
>
> int self (struct a args) {
>    return args.a;
> }

Hmm, I agree qcc should not segfault when dealing with this code,
however I don't see what is wrong with the following version:

struct {
int a;
} a;

int self (struct a args) {
return args.a;
}

which compiles fine and seems simpler to me.

> 4) Arguments to foreach_loops only sometimes need to be separated by
> a comma. E.g.:
>
> double a = 0, b = 0;
> foreach_face (x reduction(+:a) reduction(+:b)) {
>          a += x;
>          b += y;
> }
>
> requires only 1 comma ( `x redu...` -> `x, redu...` ). I believe it was
> fully optional in the past (which was also confusing).

The commas were not meant to be optional in the old qcc. This probably
was due to a bug in the code.

In the new Basilisk C grammar, see:

http://basilisk.fr/src/ast/basilisk.yacc#basilisk-c-grammar-extensions

arguments to foreach statements (i.e. foreach_parameters) must be
comma-separated.

One of the possible parameters is a "reduction list" i.e. a
space-separated (not comma-separated) list of reductions.

This is also what was intended with the old version.

It is consistent with the syntax of reductions in OpenMP.

cheers,

Stephane

Andrés Castillo-Castellanos

unread,
Apr 17, 2023, 8:02:05 PM4/17/23
to basilisk-fr
Hello!

I'm a big fan of the volumetric rendering in Antoon's bwatch but I reckon that making it work with the latest version is a lot of work (I gave it a shot). Do we have an alternative for in-situ volumetric rendering? 

Best regards,

j.a.v...@gmail.com

unread,
Apr 18, 2023, 3:26:11 AM4/18/23
to basilisk-fr
Hallo,

> I gave it a shot

What issues arose? This example, including volumetric rendering, should run fine:


I patched it earlier this month. 

 The adaptive raycaster is still broken and the "watch along" option remains untested.

Antoon
Op dinsdag 18 april 2023 om 02:02:05 UTC+2 schreef thuc...@gmail.com:
Reply all
Reply to author
Forward
0 new messages