McCode
McCode copied to clipboard
Likely issue with input parameter vs. particle param clash -> cogen prefixing need?
Working with McXtrace (experimental conda-port) on windows - which uses the visual c compiler (cl.exe
), I have stumbled upon this interesting issue:
The instrument ATHENA_cfgA_1mm.instr (and other very similar ones) won't immediately compile:
(base) C:\Users\pkwi\ESRF_BM29\mctest\20240228_1231_52\3.4.24_Windows\ATHENA_cfgA_1mm>mxrun -c ATHENA_cfgA_1mm.instr
WARNING: Full-path compiler "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/cl.exe" not found!!
WARNING: Attempting replacement by "cl.exe"
INFO: No output directory specified (--dir)
INFO: Using directory: "ATHENA_cfgA_1mm_20240301_090824"
INFO: Regenerating c-file: ATHENA_cfgA_1mm.c
WARNING:
--> USERVAR nid is of type long long and may need specific
--> per-particle initialisation through an
--> EXTEND block!
-----------------------------------------------------------
Generating single GPU kernel or single CPU section layout:
-----------------------------------------------------------
Generating GPU/CPU -DFUNNEL layout:
-----------------------------------------------------------
CFLAGS=
INFO: Recompiling: ATHENA_cfgA_1mm.exe
Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30153 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
cl : Command line warning D9002 : ignoring unknown option '-lm'
ATHENA_cfgA_1mm.c
ATHENA_cfgA_1mm.c(2207): warning C4477: 'fprintf' : format string '%li' requires an argument of type 'long', but variadic argument 1 has type 'size_t'
ATHENA_cfgA_1mm.c(2207): note: consider using '%zi' in the format string
ATHENA_cfgA_1mm.c(5777): warning C4477: 'printf' : format string '%i' requires an argument of type 'int', but variadic argument 1 has type 'void *'
ATHENA_cfgA_1mm.c(5777): warning C4313: 'printf': '%i' in format string conflicts with argument 1 of type 'void *'
ATHENA_cfgA_1mm.c(6474): error C2632: 'int' followed by '__int64' is illegal
ATHENA_cfgA_1mm.c(6474): error C2208: 'int': no members defined using this type
Specifically ATHENA_cfgA_1mm.c(6474): error C2632: 'int' followed by '__int64' is illegal
relating to an input parameter called hyper
.
Interestingly, changing hyper
to e.g. Hyper
lets the instrument function as expected... So I suspect the various defines relating to hyper are clashing... (Which they likely do on all plaforms, it is just that only cl.exe
complains....)
grep hyper ATHENA_cfgA_1mm.c | grep -i define
#define hyper (instrument->_parameters.hyper)
#define hyperref (_particle->hyperref)
#define hyperscatter (_particle->hyperscatter)
#define hyperref (_particle->hyperref)
#define hyperscatter (_particle->hyperscatter)
#define hyperref (_particle->hyperref)
#define hyperscatter (_particle->hyperscatter)
#define hyperref (_particle->hyperref)
#define hyperscatter (_particle->hyperscatter)
#define hyperref (_particle->hyperref)
#define hyperscatter (_particle->hyperscatter)