yungyuc / turgon Goto Github PK
View Code? Open in Web Editor NEWCode and notes for the CESE method
Code and notes for the CESE method
GitHub Codespaces: https://github.com/features/codespaces
Codespaces document: https://docs.github.com/en/free-pro-team@latest/github/developing-online-with-codespaces
This ticket is to collect information for the libst
sprint (scisprint20#2). To join the sprint please comment on this issue with your name (in addition to GitHub account).
Last sprint: #10
Last time the progress was to the last phase of environment setup.
Github | name |
---|---|
@YenPeiChen07 | Jenny Yen |
@yungyuc | Yung-Yu |
@yuko29 | Yu-Fang Hu |
@OhMyBuggg | Po-Yu Liu |
@Joechiaotung | Chiung-I Wu |
@sophiiim05g | Shu-Fen Yu |
@plChao | Ping-Lien Chao |
Spacetime BUILD_PATH
is hard-coded as dev37
or dbg37
.
It should somehow reflect the Python version used in the compile time:
$ make
...
-- Found PythonInterp: /usr/bin/python3.8 (found version "3.8.3")
-- Found PythonLibs: /usr/lib/libpython3.8.so
-- pybind11_INCLUDE_DIRS: /usr/include;/usr/include/python3.8
...
-- Generating done
-- Build files have been written to: /dev/turgon/spacetime/build/dev37
make -C build/dev37 VERBOSE= _libst
make[1]: Entering directory '/dev/turgon/spacetime/build/dev37'
...
Thanks yy hosting sprint!
When I was building project in Ubuntu, I encounter some problem because there are some difference between CI environment and Ubuntu local environment.
These are notes about how to build in Ubuntu 18.04 environment.
First, we need to install some dependency in order to run make pytest
in /spacetime
.
Run the command below to install dependency.
sudo apt-get -qy install \
sudo curl git build-essential make cmake libc6-dev gcc-7 g++-7 \
python3.7 python3.7-dev python3.7-venv
sudo rm /usr/bin/python3
sudo ln -s python3.7 /usr/bin/python3
sudo apt install python3-pip
sudo pip3 install -U pip
sudo pip3 install -U numpy pytest setuptools cmake
Second, we need to install some dependency by running ./install.sh everything
in /contrib/depend
Now, we can run make pytest
in /spacetime
to check if the project can run well.
I noticed that pytest log showed 23 warnings , here are some waring message
=============================== warnings summary ===============================
tests/test_celm_selm.py:104
/home/runner/work/turgon/turgon/spacetime/tests/test_celm_selm.py:104: DeprecationWarning: invalid escape sequence (
"Celm(xindex=2)::move_at(offset=-1): xindex = 1 "
tests/test_celm_selm.py:105
/home/runner/work/turgon/turgon/spacetime/tests/test_celm_selm.py:105: DeprecationWarning: invalid escape sequence [
"outside the interval [2, 23)",
tests/test_celm_selm.py:112
/home/runner/work/turgon/turgon/spacetime/tests/test_celm_selm.py:112: DeprecationWarning: invalid escape sequence (
"Celm(xindex=22)::move_at(offset=1): xindex = 23 "
.
.
.
It seems to be caused by the regular expression in assert message.
I found that the turgon's google test(gtest) cannot pass on ubuntu 18.04, because of g++ syntax error:
In file included from .../turgon/spacetime/include/spacetime/ElementBase.hpp:9:0,
from .../turgon/spacetime/include/spacetime.hpp:13,
from .../turgon/spacetime/gtests/main.cpp:3:
.../turgon/spacetime/include/spacetime/Field_decl.hpp:32:29: error: ‘function’ in namespace ‘std’ does not name a template type
using calc_type1 = std::function<value_type(Selm const &, size_t)>;
^~~~~~~~
.../turgon/spacetime/include/spacetime/Field_decl.hpp:33:29: error: ‘function’ in namespace ‘std’ does not name a template type
using calc_type2 = std::function<void (Selm &)>;
^~~~~~~~
.../turgon/spacetime/include/spacetime/Field_decl.hpp:45:5: error: ‘calc_type1’ does not name a type; did you mean ‘value_type’?
calc_type1 const & xn_calc() const { return m_xn_calc; }
^~~~~~~~~~
value_type
.
.
.
.
It seems to be missing#include <functional>
in turgon/spacetime/include/spacetime/Field_decl.hpp
, but I don't have same problem on macos.
I also try to add #include <functional>
into turgon/spacetime/include/spacetime/Field_decl.hpp
, then the gtest will pass.
This ticket is to collect information for the libst
sprint (scisprint20#1). To join the sprint please comment on this issue with your name (in addition to GitHub account).
Gitter: https://gitter.im/yyc-turgon/community
Numerical simulation of partial differential equations is a powerful tool for studying complex problems. The simulation is too specialized to use general software, and we have to pursue custom code that takes a lot of time to develop. libst is such a custom code, but it attempts to employ the modern tool chain that allows customization without impacting runtime performance. The kernel uses modern C++, and provides Python interface for easy scripting. We would like to keep both flexibility and performance.
Another goal is to handle complex geometry. It is required for industry application. The challenge is to avoid ad hoc code. At the moment, libst has only one-dimensional grid. Meshes in multi-dimensional space will follow by porting from its predecessor SOLVCON.
The target users will be both academic and industry. It is open-source for productivity and frictionless utilization. It uses mainstream practices for build system, version control, unit testing, continuous integration, and other engineering infrastructure.
The sprint will focus more on the (software) engineering. We will try to improve the following aspects of the code:
We are not limited to the above topics. New ideas are welcome.
GitHub | name |
---|---|
@yungyuc | Yung-Yu Chen |
@tenacity0310 | Peter Li |
@YenPeiChen07 | Jenny Yen |
@yuko29 | Yu-Fang Hu |
@OhMyBuggg | Po-Yu |
@Joechiaotung | Chuing-I |
@linyc0817 | Yen-Chun |
@kunxianhuang | Kunxian Huang |
@sophiiim05g | Shu-Fen |
@plChao | Ping-Lien |
12%] Building CXX object CMakeFiles/_libst.dir/src/python/libst.cpp.o
In file included from /usr/local/include/modmesh/python/python.hpp:36,
from /home/zdd/turgon/spacetime/include/spacetime/python.hpp:11,
from /home/zdd/turgon/spacetime/src/python/libst.cpp:6:
/usr/local/include/modmesh/python/common.hpp: In member function ‘modmesh::python::WrapBase<Wrapper, Wrapped, Holder, WrappedBase>::wrapper_type& modmesh::python::WrapBase<Wrapper, Wrapped, Holder, WrappedBase>::expose_SimpleArray(const char*, Func&&)’:
/usr/local/include/modmesh/python/common.hpp:311:47: error: ‘invoke_result_t’ in namespace ‘std’ does not name a template type
311 | using array_reference = typename std::invoke_result_t<Func, wrapped_type &>;
| ^~~~~~~~~~~~~~~
/usr/local/include/modmesh/python/common.hpp:311:47: note: ‘std::invoke_result_t’ is only available from C++17 onwards
/usr/local/include/modmesh/python/common.hpp:312:41: error: ‘array_reference’ was not declared in this scope
312 | static_assert(std::is_reference<array_reference>::value, "this_array_reference is not a reference");
| ^~~~~~~~~~~~~~~
/usr/local/include/modmesh/python/common.hpp:312:56: error: template argument 1 is invalid
312 | static_assert(std::is_reference<array_reference>::value, "this_array_reference is not a reference");
| ^
/usr/local/include/modmesh/python/common.hpp:314:75: error: ‘’ is not a template [-fpermissive]
314 | ing array_type = typename std::remove_reference<array_reference>::type;
| ^~
/usr/local/include/modmesh/python/common.hpp:319:46: error: ‘array_reference’ does not name a type
319 | [&f](wrapped_type & self) -> array_reference
| ^~~~~~~~~~~~~~~
/usr/local/include/modmesh/python/common.hpp:321:86: error: template argument 1 is invalid
321 | pped_type & self, py::array_t & ndarr)
| ^
/usr/local/include/modmesh/python/common.hpp: In lambda function:
/usr/local/include/modmesh/python/common.hpp:323:21: error: ‘array_reference’ is not captured
323 | array_reference this_array = f(self);
| ^~~~~~~~~~~~~~~
/usr/local/include/modmesh/python/common.hpp:321:20: note: the lambda has no capture-default
321 | [&f](wrapped_type & self, py::array_t & ndarr)
| ^
/usr/local/include/modmesh/python/common.hpp:312:41: note: ‘array_reference’ declared here
312 | static_assert(std::is_reference<array_reference>::value, "this_array_reference is not a reference");
| ^~~~~~~~~~~~~~~
/usr/local/include/modmesh/python/common.hpp:324:25: error: ‘this_array’ was not declared in this scope
324 | if (this_array.nbytes() != static_cast<size_t>(ndarr.nbytes()))
| ^~~~~~~~~~
/usr/local/include/modmesh/python/common.hpp:324:74: error: request for member ‘nbytes’ in ‘ndarr’, which is of non-class type ‘int’
324 | if (this_array.nbytes() != static_cast<size_t>(ndarr.nbytes()))
| ^~~~~~
/usr/local/include/modmesh/python/common.hpp:327:38: error: request for member ‘nbytes’ in ‘ndarr’, which is of non-class type ‘int’
327 | msg << ndarr.nbytes() << " bytes of input array differ from "
| ^~~~~~
/usr/local/include/modmesh/python/common.hpp:331:36: error: no matching function for call to ‘makeSimpleArray(int&)’
331 | makeSimpleArray(ndarr).swap(this_array);
| ~~~~~~~~~~~~~~~^~~~~~~
/usr/local/include/modmesh/python/common.hpp:194:23: note: candidate: ‘template modmesh::SimpleArray modmesh::python::makeSimpleArray(pybind11::array_t&)’
194 | static SimpleArray makeSimpleArray(pybind11::array_t & ndarr)
| ^~~~~~~~~~~~~~~
/usr/local/include/modmesh/python/common.hpp:194:23: note: template argument deduction/substitution failed:
/usr/local/include/modmesh/python/common.hpp:331:36: note: mismatched types ‘pybind11::array_t’ and ‘int’
331 | makeSimpleArray(ndarr).swap(this_array);
| ~~~~~~~~~~~~~~~^~~~~~~
/usr/local/include/modmesh/python/common.hpp:331:49: error: ‘this_array’ was not declared in this scope
331 | makeSimpleArray(ndarr).swap(this_array);
| ^~~~~~~~~~
/usr/local/include/modmesh/python/common.hpp: In member function ‘modmesh::python::WrapBase<Wrapper, Wrapped, Holder, WrappedBase>::wrapper_type& modmesh::python::WrapBase<Wrapper, Wrapped, Holder, WrappedBase>::expose_SimpleArrayAsNdarray(const char*, Func&&)’:
/usr/local/include/modmesh/python/common.hpp:344:47: error: ‘invoke_result_t’ in namespace ‘std’ does not name a template type
344 | using array_reference = typename std::invoke_result_t<Func, wrapped_type &>;
| ^~~~~~~~~~~~~~~
/usr/local/include/modmesh/python/common.hpp:344:47: note: ‘std::invoke_result_t’ is only available from C++17 onwards
/usr/local/include/modmesh/python/common.hpp:345:41: error: ‘array_reference’ was not declared in this scope
345 | static_assert(std::is_reference<array_reference>::value, "this_array_reference is not a reference");
| ^~~~~~~~~~~~~~~
/usr/local/include/modmesh/python/common.hpp:345:56: error: template argument 1 is invalid
345 | static_assert(std::is_reference<array_reference>::value, "this_array_reference is not a reference");
| ^
/usr/local/include/modmesh/python/common.hpp:347:75: error: ‘’ is not a template [-fpermissive]
347 | ing array_type = typename std::remove_reference<array_reference>::type;
| ^~
/usr/local/include/modmesh/python/common.hpp:354:86: error: template argument 1 is invalid
354 | pped_type & self, py::array_t & ndarr)
| ^
/usr/local/include/modmesh/python/common.hpp: In lambda function:
/usr/local/include/modmesh/python/common.hpp:356:21: error: ‘array_reference’ is not captured
356 | array_reference this_array = f(self);
| ^~~~~~~~~~~~~~~
/usr/local/include/modmesh/python/common.hpp:354:20: note: the lambda has no capture-default
354 | [&f](wrapped_type & self, py::array_t & ndarr)
| ^
/usr/local/include/modmesh/python/common.hpp:345:41: note: ‘array_reference’ declared here
345 | static_assert(std::is_reference<array_reference>::value, "this_array_reference is not a reference");
| ^~~~~~~~~~~~~~~
/usr/local/include/modmesh/python/common.hpp:357:25: error: ‘this_array’ was not declared in this scope
357 | if (this_array.nbytes() != static_cast<size_t>(ndarr.nbytes()))
| ^~~~~~~~~~
/usr/local/include/modmesh/python/common.hpp:357:74: error: request for member ‘nbytes’ in ‘ndarr’, which is of non-class type ‘int’
357 | if (this_array.nbytes() != static_cast<size_t>(ndarr.nbytes()))
| ^~~~~~
/usr/local/include/modmesh/python/common.hpp:360:38: error: request for member ‘nbytes’ in ‘ndarr’, which is of non-class type ‘int’
360 | msg << ndarr.nbytes() << " bytes of input array differ from "
| ^~~~~~
/usr/local/include/modmesh/python/common.hpp:364:21: error: ‘this_array’ was not declared in this scope
364 | this_array.swap(makeSimpleArray(ndarr));
| ^~~~~~~~~~
/usr/local/include/modmesh/python/common.hpp:364:52: error: no matching function for call to ‘makeSimpleArray(int&)’
364 | this_array.swap(makeSimpleArray(ndarr));
| ~~~~~~~~~~~~~~~^~~~~~~
/usr/local/include/modmesh/python/common.hpp:194:23: note: candidate: ‘template modmesh::SimpleArray modmesh::python::makeSimpleArray(pybind11::array_t&)’
194 | static SimpleArray makeSimpleArray(pybind11::array_t & ndarr)
| ^~~~~~~~~~~~~~~
/usr/local/include/modmesh/python/common.hpp:194:23: note: template argument deduction/substitution failed:
/usr/local/include/modmesh/python/common.hpp:364:52: note: mismatched types ‘pybind11::array_t’ and ‘int’
364 | this_array.swap(makeSimpleArray(ndarr));
| ~~~~~~~~~~~~~~~^~~~~~~
In file included from /home/zdd/turgon/spacetime/src/python/libst.cpp:6:
/home/zdd/turgon/spacetime/include/spacetime/python.hpp: In function ‘void spacetime::python::initialize(pybind11::module&)’:
/home/zdd/turgon/spacetime/include/spacetime/python.hpp:88:56: error: no match for call to ‘(modmesh::python::OneTimeInitializerspacetime::python::init_tag) (pybind11::module&, bool, void (&)(pybind11::module&))’
88 | modmesh::python::OneTimeInitializer<init_tag>::me()(mod, true, detail::initialize_impl);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/zdd/turgon/spacetime/include/spacetime/python.hpp:11,
from /home/zdd/turgon/spacetime/src/python/libst.cpp:6:
/usr/local/include/modmesh/python/python.hpp:69:29: note: candidate: ‘modmesh::python::OneTimeInitializer& modmesh::python::OneTimeInitializer::operator()(pybind11::module&, const std::function<void(pybind11::module_&)>&) [with T = spacetime::python::init_tag; pybind11::module = pybind11::module_]’
69 | OneTimeInitializer & operator()(
| ^~~~~~~~
/usr/local/include/modmesh/python/python.hpp:69:29: note: candidate expects 2 arguments, 3 provided
make[2]: *** [CMakeFiles/_libst.dir/build.make:82: CMakeFiles/_libst.dir/src/python/libst.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:204: CMakeFiles/_libst.dir/all] Error 2
make: *** [Makefile:149: all] Error 2
I found CMakeList.txt
under folder /turgon/spacetime
and I tried to build it, but the cmake log showed that it can not find the path to xtensor
, xtensor-python
, xsimd
, xtl
packages
I already install these packages with conda, but it still can not find them.
I can't figure out where is wrong. Is it because I use mac OS? Or I have to build the packages from source code directly?
This ticket is to collect information for the libst sprint (scisprint20#3). To join the sprint please comment on this issue with your name (in addition to GitHub account).
Date: Sat, 24th October, 2020
Time: 13:30 -- 16:30
Venue: R101, Engineering Bldg. 4, NCTU
Discord: https://discord.gg/P9U7PFv
Last sprint: #13
Github | name |
---|---|
@yungyuc | Yung-Yu |
@j8xixo12 | Chun-Hsu |
@yuko29 | Yu-Fang |
When I use command cmake /home/joe/turgon/spacetime/
and I can't figure out why pthread_create can't be find.
the following is log from terminal after I type.
CMake Error at CMakeLists.txt:5 (cmake_policy): Policy "CMP0074" is not known to this version of CMake.
-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- BUILD_GTESTS: ON
-- HIDE_SYMBOL: OFF
-- DEBUG_SYMBOL: ON
-- not use clang-tidy
-- Found PythonInterp: /usr/bin/python3.6 (found version "3.6.9")
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.6m.so
-- pybind11_INCLUDE_DIRS: /usr/include;/usr/include/python3.6m
-- Found NumPy: /usr/lib/python3/dist-packages/numpy/core/include (found version "1.13.3")
-- NUMPY_INCLUDE_DIR: /usr/lib/python3/dist-packages/numpy/core/include
-- modmesh_INCLUDE_DIR: /usr/include
-- modmesh_INCLUDE_DIR: /usr/include
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- LTO enabled
-- Configuring done
-- Generating done
-- Build files have been written to: /home/joe/turgon/spacetime/build/gtests/googletest-download
Scanning dependencies of target googletest [ 11%] Creating directories for 'googletest' [ 22%] Performing download step (download, verify and extract) for 'googletest' -- Downloading... dst='/home/joe/turgon/spacetime/build/gtests/googletest-download/googletest-prefix/src/release-1.8.1.tar.gz' timeout='none' -- Using src='https://github.com/google/googletest/archive/release-1.8.1.tar.gz' -- verifying file... file='/home/joe/turgon/spacetime/build/gtests/googletest-download/googletest-prefix/src/release-1.8.1.tar.gz' -- Downloading... done -- extracting... src='/home/joe/turgon/spacetime/build/gtests/googletest-download/googletest-prefix/src/release-1.8.1.tar.gz' dst='/home/joe/turgon/spacetime/build/gtests/googletest-src' -- extracting... [tar xfz] -- extracting... [analysis] -- extracting... [rename] -- extracting... [clean up] -- extracting... done [ 33%] No patch step for 'googletest' [ 44%] No update step for 'googletest' [ 55%] No configure step for 'googletest' [ 66%] No build step for 'googletest' [ 77%] No install step for 'googletest' [ 88%] No test step for 'googletest' [100%] Completed 'googletest' [100%] Built target googletest
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Configuring incomplete, errors occurred!
See also "/home/joe/turgon/spacetime/build/CMakeFiles/CMakeOutput.log".
See also "/home/joe/turgon/spacetime/build/CMakeFiles/CMakeError.log".
And the following is content in CMakeError.log.
Determining if the pthread_create exist failed with the following output: Change Dir: /home/joe/turgon/spacetime/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_8080e/fast" /usr/bin/make -f CMakeFiles/cmTC_8080e.dir/build.make CMakeFiles/cmTC_8080e.dir/build make[1]: Entering directory '/home/joe/turgon/spacetime/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_8080e.dir/CheckSymbolExists.c.o /usr/bin/cc -o CMakeFiles/cmTC_8080e.dir/CheckSymbolExists.c.o -c /home/joe/turgon/spacetime/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c Linking C executable cmTC_8080e /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8080e.dir/link.txt --verbose=1 /usr/bin/cc -rdynamic CMakeFiles/cmTC_8080e.dir/CheckSymbolExists.c.o -o cmTC_8080e CMakeFiles/cmTC_8080e.dir/CheckSymbolExists.c.o: 於函式 main: CheckSymbolExists.c:(.text+0x1b): 未定義參考到 pthread_create collect2: error: ld returned 1 exit status CMakeFiles/cmTC_8080e.dir/build.make:97: recipe for target 'cmTC_8080e' failed make[1]: *** [cmTC_8080e] Error 1 make[1]: Leaving directory '/home/joe/turgon/spacetime/build/CMakeFiles/CMakeTmp' Makefile:126: recipe for target 'cmTC_8080e/fast' failed make: *** [cmTC_8080e/fast] Error 2
File /home/joe/turgon/spacetime/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c: /* */ #include <pthread.h> int main(int argc, char** argv) { (void)argv; #ifndef pthread_create return ((int*)(&pthread_create))[argc]; #else (void)argc; return 0; #endif }
If we can write solving kernels in Python, it will be efficient to prototype how a new model problem should work with libst
. Without it, we currently have to write C++ code, which heavily use template, to model a problem.
This issue keeps track of the initial work of the sub-system, and I think we should focus on the scalar equation, for now.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.