Skip to content

Replace Makefile build back end with SConstruct - #330

Merged
BryanRumsey merged 7 commits into
developfrom
init-scons
Feb 9, 2023
Merged

Replace Makefile build back end with SConstruct#330
BryanRumsey merged 7 commits into
developfrom
init-scons

Conversation

@jtcooper10

@jtcooper10jtcooper10 commented Nov 14, 2022

Copy link
Copy Markdown
Contributor

Replaces the Makefile scripts with corresponding SCons ones. The build artifacts should be roughly equivalent. Tested on Windows, still needs to be tested on Linux and Mac.

@briandrawertbriandrawert added this to the 1.2.0 Release milestone Dec 22, 2022
- Fix variant directories and env defines
- Add source files to ANN and src
- Modified `solver.py` to reference SCons
- Fixed debugging errors in compile method
- Updated SCons files to define lib in main script
@jtcooper10
jtcooper10 marked this pull request as ready for review February 2, 2023 21:46

@BryanRumseyBryanRumsey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Examples failed on MacOS

Compiler

bryanrumsey@Bryans-MacBook-Pro stochss % g++ --version
Apple clang version 14.0.0 (clang-1400.0.29.201)
Target: arm64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Errors

scons: Entering directory `/var/folders/z4/bqpnd_kx7xg3s3c9jtz0pnfh0000gn/T/spatialpy_build_dxo110kt'
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o /var/folders/z4/bqpnd_kx7xg3s3c9jtz0pnfh0000gn/T/spatialpy_build_dxo110kt/3DCylinderDemo_generated_model.o -c -std=c++14 -I/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/include -I/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/external/ANN/include /var/folders/z4/bqpnd_kx7xg3s3c9jtz0pnfh0000gn/T/spatialpy_build_dxo110kt/3DCylinderDemo_generated_model.cpp
g++ -o /var/folders/z4/bqpnd_kx7xg3s3c9jtz0pnfh0000gn/T/spatialpy_core/bryanrumsey/count_cores.o -c -std=c++14 -I/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/include -I/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/external/ANN/include /Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/src/count_cores.cpp
g++ -o /var/folders/z4/bqpnd_kx7xg3s3c9jtz0pnfh0000gn/T/spatialpy_core/bryanrumsey/model.o -c -std=c++14 -I/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/include -I/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/external/ANN/include /Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/src/model.cpp
g++ -o /var/folders/z4/bqpnd_kx7xg3s3c9jtz0pnfh0000gn/T/spatialpy_core/bryanrumsey/NRMConstant_v5.o -c -std=c++14 -I/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/include -I/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/external/ANN/include /Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/src/NRMConstant_v5.cpp
g++ -o /var/folders/z4/bqpnd_kx7xg3s3c9jtz0pnfh0000gn/T/spatialpy_core/bryanrumsey/output.o -c -std=c++14 -I/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/include -I/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/external/ANN/include /Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/src/output.cpp
/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/src/output.cpp:37:9: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
sprintf(filename,"output_%u.csv",current_step);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
^
/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/src/output.cpp:111:13: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
sprintf(filename, "output0_boundingBox.vtk");
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
^
/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/src/output.cpp:129:9: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
sprintf(filename,"output%u.vtk", output_index++);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
^
3 warnings generated.
g++ -o /var/folders/z4/bqpnd_kx7xg3s3c9jtz0pnfh0000gn/T/spatialpy_core/bryanrumsey/particle.o -c -std=c++14 -I/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/include -I/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/external/ANN/include /Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/src/particle.cpp
g++ -o /var/folders/z4/bqpnd_kx7xg3s3c9jtz0pnfh0000gn/T/spatialpy_core/bryanrumsey/pthread_barrier.o -c -std=c++14 -I/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/include -I/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/external/ANN/include /Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/src/pthread_barrier.cpp
g++ -o /var/folders/z4/bqpnd_kx7xg3s3c9jtz0pnfh0000gn/T/spatialpy_core/bryanrumsey/read_lammps_input_file.o -c -std=c++14 -I/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/include -I/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/external/ANN/include /Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/src/read_lammps_input_file.cpp
/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/src/read_lammps_input_file.cpp:97:14: error: use of undeclared identifier 'create_particle'
me = create_particle(id);
^
/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/src/read_lammps_input_file.cpp:105:9: error: use of undeclared identifier 'add_particle'
add_particle(me,system);
^
2 errors generated.
scons: *** [/var/folders/z4/bqpnd_kx7xg3s3c9jtz0pnfh0000gn/T/spatialpy_core/bryanrumsey/read_lammps_input_file.o] Error 1
scons: building terminated because of errors.
---------------------------------------------------------------------------
CalledProcessError Traceback (most recent call last)
File ~/SpatialPy/spatialpy/solvers/solver.py:492, in Solver.compile(self, debug, profile)
491 try:
--> 492 result = subprocess.check_output(make_cmd, stderr=subprocess.STDOUT)
493 if self.debug_level > 1:
File /opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py:420, in check_output(timeout, *popenargs, **kwargs)
418 kwargs['input'] = empty
--> 420 return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
421 **kwargs).stdout
File /opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py:524, in run(input, capture_output, timeout, check, *popenargs, **kwargs)
523 if check and retcode:
--> 524 raise CalledProcessError(retcode, process.args,
525 output=stdout, stderr=stderr)
526 return CompletedProcess(process.args, retcode, stdout, stderr)
CalledProcessError: Command '['/opt/homebrew/opt/python@3.10/bin/python3.10', '-m', 'SCons', '-C/var/folders/z4/bqpnd_kx7xg3s3c9jtz0pnfh0000gn/T/spatialpy_build_dxo110kt', '-f/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine/build/SConstruct', 'ROOT=/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine', 'ROOTINC=/Users/bryanrumsey/SpatialPy/spatialpy/solvers/c_base/ssa_sdpd-c-simulation-engine', 'COREDIR=/var/folders/z4/bqpnd_kx7xg3s3c9jtz0pnfh0000gn/T/spatialpy_core/bryanrumsey', 'MODEL=/var/folders/z4/bqpnd_kx7xg3s3c9jtz0pnfh0000gn/T/spatialpy_build_dxo110kt/3DCylinderDemo_generated_model.cpp', 'BUILD=/var/folders/z4/bqpnd_kx7xg3s3c9jtz0pnfh0000gn/T/spatialpy_build_dxo110kt']' returned non-zero exit status 2.
During handling of the above exception, another exception occurred:
SimulationError Traceback (most recent call last)
File <timed exec>:1
File ~/SpatialPy/spatialpy/core/model.py:1055, in Model.run(self, number_of_trajectories, seed, timeout, number_of_threads, debug_level, debug, profile)
1051 from spatialpy.solvers.solver import Solver # pylint: disable=import-outside-toplevel
1053 sol = Solver(self, debug_level=debug_level)
-> 1055 return sol.run(number_of_trajectories=number_of_trajectories, seed=seed, timeout=timeout,
1056 number_of_threads=number_of_threads, debug=debug, profile=profile)
File ~/SpatialPy/spatialpy/solvers/solver.py:547, in Solver.run(self, number_of_trajectories, seed, timeout, number_of_threads, debug, profile, verbose)
545 # Check if compiled, call compile() if not.
546 if not self.is_compiled:
--> 547 self.compile(debug=debug, profile=profile)
549 # Execute the solver
550 for run_ndx in range(number_of_trajectories):
File ~/SpatialPy/spatialpy/solvers/solver.py:500, in Solver.compile(self, debug, profile)
498 except Exception:
499 pass
--> 500 raise SimulationError(f"Compilation of solver failed, return_code={err.returncode}")
501 except OSError as err:
502 cmd = " ".join(make_cmd)
SimulationError: Compilation of solver failed, return_code=2

@briandrawert

Copy link
Copy Markdown
Member

I also get the same error with:

$g++ --version
g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

@BryanRumsey
BryanRumsey merged commit 4fec4a2 into developFeb 9, 2023
@BryanRumsey
BryanRumsey deleted the init-scons branch February 9, 2023 18:14
@BryanRumseyBryanRumsey mentioned this pull request Feb 9, 2023
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@jtcooper10@briandrawert@BryanRumsey