Tests #72
Replies: 3 comments 3 replies
-
Hi Emily. Thanks for the kind words. Great that you are considering using STC. I am on my way to a seminar, so I will give a response within 1-2 days. |
Beta Was this translation helpful? Give feedback.
-
First, Pyccel looks very interesting, I was not aware of it. I work in climate science, and most climate models/simulators we use (or developed by colleagues) are written in Fortran, so Pyccel can be a very useful tool for us. My background is mostly using C++/C/Python. As for your questions. The test and build scripts have unfortunately not been prioritized, but it is something I would like to do before the next release, i.e. proper CMake/Make files and update the github CI script. The test framework I use was added after I developed most of the containers, and I never came around to make proper tests for all the containers. Unfortunately, it's quite a bit of work to do it after development, at least if you aim to include a lot of edge cases. However, the example files cover large portions of the functionality and they print out results which would indicate success, so as a primitive test, I compile, run all examples and output it as one file and diff it with the previous run. I will make this method available as a target in the Makefile to have some sort of automatic testing for now. STC has been under development since 2020, and is used by quite a few users at this point. Very few bugs have been reported, and there are no obvious bugs I am aware of, so at least the current state of the code should be good. Still, because not every function is thoroughly documented, there are inputs which may result in UB that are not specifically documented, but it is mostly consistent with how C++ STL is behaving regarding UB. STC also uses static asserts where possible, e.g. in the generic cspan implementation (which could be relevant for Pyccel). So far, I have purposedly not exposed it too much in order to have freedom to do some changes to the API without affecting existing users too much. V5.0 will have a mostly frozen API, so there may still be a few API changes before that (allocators may be one - see discussion. Will only affect you if you use custom allocators). Hope this hasn't scared you off using STC, as it would be very valuable to see real-world usage in a larger project, and in particular such a useful/interesting one. |
Beta Was this translation helpful? Give feedback.
-
An example with multidim arrays. Gives identical runtime output. Python code: import numpy as np
a = np.arange(64).reshape(4,4)
b = a[2:, :3]
c = a[1]
d = c[2]
print(a, "")
print(b, "")
print(c)
print(d) C equivalent: https://godbolt.org/z/ofhz3xzcj #include <stdio.h>
#include <stdint.h>
typedef int64_t i64;
#define i_val i64
#include "stc/cvec.h"
#include "stc/cspan.h"
using_cspan(n1array_i64, i64, 1);
using_cspan(n2array_i64, i64, 2);
int main()
{
cvec_i64 a_storage = {0};
c_forrange (i, 4*4) cvec_i64_push(&a_storage, i);
n2array_i64 a = cspan_md(a_storage.data, 4, 4);
n2array_i64 b = cspan_slice(n2array_i64, &a, {2,c_END}, {0,3});
n1array_i64 c = cspan_submd2(&a, 1);
int64_t d = *cspan_at(&c, 2);
cspan_print(n2array_i64, a);
cspan_print(n2array_i64, b);
cspan_print(n1array_i64, c);
printf("%zi\n", d);
cvec_i64_drop(&a_storage);
} |
Beta Was this translation helpful? Give feedback.
-
This repository seems to be a really well documented implementation of fast containers. Congratulations.
I am one of the developers on the Pyccel project. Pyccel is a transpiler which translates Python code to C (or Fortran). We are trying to increase our support for containers at the moment and have been looking for an existing implementation that we can use in our generated code. We are thinking about using STC. Would you have any objections to this?
We were thinking of including the dependency via a git submodule (the project would of course be mentioned in the project requirements, etc).
However one thing that we found a little concerning when looking at this repository is that we can't seem to find the tests. I found this folder:
https://github.com/stclib/STC/tree/master/misc/tests
But it contains significantly less code than the examples and benchmarks folders and not all these tests seem to be run on the CI:
https://github.com/stclib/STC/actions/workflows/workflow.yml
Is there something that we are missing? Are there tests run elsewhere?
cc: @tylov
Beta Was this translation helpful? Give feedback.
All reactions