Skip to content

Commit

Permalink
added prints
Browse files Browse the repository at this point in the history
  • Loading branch information
jrenaud90 committed Nov 30, 2024
1 parent 701bdc3 commit b19afa8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
10 changes: 8 additions & 2 deletions CyRK/cy/cysolver.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <cstring>

#include <cstdio>
#include "cysolver.hpp"
#include "dense.hpp"
#include "cysolution.hpp"
Expand Down Expand Up @@ -67,10 +67,13 @@ CySolverBase::CySolverBase(
{
// Allocate memory for the size of args.
// Store void pointer to it.
printf("Pre Malloc\n");
this->args_ptr = malloc(size_of_args);

// Copy over contents of arg
printf("Pre Copy Over\n");
std::memcpy(this->args_ptr, args_ptr, size_of_args);
printf("Post\n");
}

// Check for errors
Expand Down Expand Up @@ -175,7 +178,10 @@ CySolverBase::~CySolverBase()
// Release args data
if (args_built)
{
free(this->args_ptr);
if (this->args_ptr)
{
free(this->args_ptr);
}
}
}

Expand Down
12 changes: 9 additions & 3 deletions CyRK/cy/cysolver_test.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ def cy_extra_output_tester():

return passed

from libc.stdio cimport printf

def cytester(
int diffeq_number,
tuple t_span = None,
Expand Down Expand Up @@ -462,13 +464,14 @@ def cytester(
t_span_ptr[0] = t_span[0]
t_span_ptr[1] = t_span[1]
if args is not None:
args_ptr = <void*>&args[0]
args_ptr = <void*>&args[0]
size_of_args = sizeof(double) * args.size
else:
args_ptr = NULL
args_ptr = NULL
size_of_args = 0

if cast_arg_dbl:
args_ptr = <void*>args_ptr_dbl
args_ptr = <void*>args_ptr_dbl
size_of_args = sizeof(args_arr)

# Parse rtol
Expand All @@ -481,6 +484,9 @@ def cytester(
if atol_array is not None:
atols_ptr = &atol_array[0]


printf("EXTRA ARGS SIZE = %d; Ptr = %p\n", size_of_args, args_ptr)

cdef CySolveOutput result = cysolve_ivp(
diffeq,
t_span_ptr,
Expand Down
2 changes: 1 addition & 1 deletion Tests/E_CySolver_Tests/test_a_cysolve_ivp.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def test_cysolve_ivp_all_diffeqs(cysolve_test_func):
on_macos = True
if not result.success and on_macos and cysolve_test_func==5:
pytest.skip("Weird macos bug on diffeq5")
on_macos = False
# on_macos = False

assert result.success
assert result.t.size > 0
Expand Down

0 comments on commit b19afa8

Please sign in to comment.