Skip to content

Remove dead C code importing time.h #1403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 1 addition & 21 deletions pytensor/tensor/blas.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,13 +460,6 @@ def c_support_code(self, **kwargs):
#ifndef MOD
#define MOD %
#endif
static double time_time() // a time function like time.perf_counter()
{
struct timeval tv;
gettimeofday(&tv, 0);
return (double) tv.tv_sec + (double) tv.tv_usec / 1000000.0;
}

void compute_strides(npy_intp *shape, int N_shape, int type_size, npy_intp *res) {
int s;
res[N_shape - 1] = type_size;
Expand All @@ -481,7 +474,7 @@ def c_support_code(self, **kwargs):
def c_headers(self, **kwargs):
# std.cout doesn't require the '%' symbol to print stuff...
# so it works much better with python's string-substitution stuff.
return ["<iostream>", "<time.h>", "<sys/time.h>"]
return ["<iostream>"]

def c_libraries(self, **kwargs):
return ldflags()
Expand Down Expand Up @@ -690,8 +683,6 @@ def c_header_dirs(self, **kwargs):
char N = 'N';
char T = 'T';
int Nz0 = Nz[0], Nz1 = Nz[1], Nx1 = Nx[1];
//std::cerr << (unit/256) MOD 16 << (unit / 16) MOD 16 << unit MOD 16<< '\\n';
//double t0 = time_time();
switch(unit)
{
case 0x000: sgemm_(&N, &N, &Nz1, &Nz0, &Nx1, &a, y, &sy_0, x, &sx_0, &b, z, &sz_0); break;
Expand All @@ -704,7 +695,6 @@ def c_header_dirs(self, **kwargs):
case 0x111: sgemm_(&N, &N, &Nz0, &Nz1, &Nx1, &a, x, &sx_1, y, &sy_1, &b, z, &sz_1); break;
default: PyErr_SetString(PyExc_ValueError, "some matrix has no unit stride"); %(fail)s;
};
//fprintf(stderr, "Calling sgemm %%i %%i %%i %%i took %%f\\n", unit, Nz1, Nz0, Nx1, time_time() - t0);
"""

case_double = """
Expand All @@ -723,14 +713,6 @@ def c_header_dirs(self, **kwargs):
char N = 'N';
char T = 'T';
int Nz0 = Nz[0], Nz1 = Nz[1], Nx1 = Nx[1];
//std::cerr << (unit/256) MOD 16 << (unit / 16) MOD 16 << unit MOD 16<< '\\n';
//double t0 = time_time();
//fprintf(stderr, "unit=%%x N= %%i %%i %%i S = %%i %%i %%i %%i %%i %%i\\n", unit,
//Nz1, Nz0, Nx1,
//sy_0, sy_1,
//sx_0, sx_1,
//sz_0, sz_1
//);
switch(unit)
{
case 0x000: dgemm_(&N, &N, &Nz1, &Nz0, &Nx1, &a, y,
Expand All @@ -753,8 +735,6 @@ def c_header_dirs(self, **kwargs):
"some matrix has no unit stride");
%(fail)s;
};
//fprintf(stderr, "Calling dgemm %%i %%i %%i %%i took %%f\\n",
// unit, Nz1, Nz0, Nx1, time_time()- t0);
"""

end_switch_typenum = """
Expand Down