Closed achedrien closed 9 months ago
@dinesh-parthasarathy can you please look into this? In case this might be already fixed in your fork, I would suggest to also create a pull request and assign it to @achedrien.
Hi @achedrien, so the reason this doesn't work is because the template file used for code generation (example_problems/FAS_2D_Basic/FAS_2D_Basic_template.exa4: line 149) calls the function 'gen_mgCycle' for solving. So, it is expected that the functions printed using EvoStencils during the optimization also have the same name. Instead of passing 'mgCycle' as the cycle name the program generator should be created with 'gen_mgCycle':
program_generator = ProgramGeneratorFAS('FAS_2D_Basic', 'Solution', 'RHS', 'Residual', 'Approximation',
'RestrictionNode', 'CorrectionNode',
'Laplace', 'gamSten', 'gen_mgCycle', 'CGS', 'Smoother', mpi_rank=mpi_rank, platform_file=platform_file, build_path=build_path,
exastencils_compiler=exastencils_compiler)
This should make the optimization work. But, I agree that setting up the FAS is a bit confusing. I will simplify the script so that it is easy to toggle between FAS and non-FAS variants. I have created a separate issue for that, so I am closing this.
After settings up a FAS test file, the FAS scheme seems not to work, in the build output file i get: m
User/User_Solve.cpp:44:28: error: stray ‘@’ in program 44 | gen_mgCycle@10(); | ^ User/User_Solve.cpp: In function ‘void Solve()’: User/User_Solve.cpp:44:17: error: ‘gen_mgCycle’ was not declared in this scope;
So exactencils is not compiled and the optimization is not performed, the test file i have created (maybe it will be nice to add a optimization_fas.py script file to test):
`from evostencils.optimization.program import Optimizer from evostencils.code_generation.exastencils_FAS import ProgramGeneratorFAS # _prime as ProgramGeneratorFAS from evostencils.code_generation.exastencils import ProgramGenerator import os import sys from mpi4py import MPI
FAS = True
def main(): cwd = f'/home/algo/gode/gode/evostencils'
Path to the ExaStencils compiler
if name == "main": main()`