Skip to content

Commit

Permalink
Implemented flops api
Browse files Browse the repository at this point in the history
  • Loading branch information
matteo-frigo committed Jan 20, 2003
1 parent 06f9de2 commit 7a7f938
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 12 deletions.
20 changes: 10 additions & 10 deletions api/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ noinst_LTLIBRARIES = libapi.la
libapi_la_SOURCES = apiplan.c configure.c dfthelp.c execute.c \
execute-dft.c execute-dft-c2r.c execute-dft-r2c.c execute-r2r.c \
export-wisdom-to-file.c export-wisdom-to-string.c export-wisdom.c \
forget-wisdom.c import-system-wisdom.c import-wisdom-from-file.c \
import-wisdom-from-string.c import-wisdom.c mapflags.c \
mkprinter-file.c mktensor-iodims.c mktensor-rowmajor.c plan-dft-1d.c \
plan-dft-2d.c plan-dft-3d.c plan-dft.c plan-guru-dft.c plan-many-dft.c \
plan-many-dft-c2r.c plan-dft-c2r.c plan-dft-c2r-1d.c plan-dft-c2r-2d.c \
plan-dft-c2r-3d.c plan-many-dft-r2c.c plan-dft-r2c.c plan-dft-r2c-1d.c \
plan-dft-r2c-2d.c plan-dft-r2c-3d.c plan-guru-dft-c2r.c \
plan-guru-dft-r2c.c map-r2r-kind.c plan-many-r2r.c plan-r2r-1d.c \
plan-r2r-2d.c plan-r2r-3d.c plan-r2r.c plan-guru-r2r.c print-plan.c \
the-planner.c rdft2-pad.c api.h fftw3.h f77api.c
flops.c forget-wisdom.c import-system-wisdom.c \
import-wisdom-from-file.c import-wisdom-from-string.c import-wisdom.c \
mapflags.c mkprinter-file.c mktensor-iodims.c mktensor-rowmajor.c \
plan-dft-1d.c plan-dft-2d.c plan-dft-3d.c plan-dft.c plan-guru-dft.c \
plan-many-dft.c plan-many-dft-c2r.c plan-dft-c2r.c plan-dft-c2r-1d.c \
plan-dft-c2r-2d.c plan-dft-c2r-3d.c plan-many-dft-r2c.c plan-dft-r2c.c \
plan-dft-r2c-1d.c plan-dft-r2c-2d.c plan-dft-r2c-3d.c \
plan-guru-dft-c2r.c plan-guru-dft-r2c.c map-r2r-kind.c plan-many-r2r.c \
plan-r2r-1d.c plan-r2r-2d.c plan-r2r-3d.c plan-r2r.c plan-guru-r2r.c \
print-plan.c the-planner.c rdft2-pad.c api.h fftw3.h f77api.c
6 changes: 4 additions & 2 deletions api/fftw3.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

/* header file for fftw3 */
/* $Id: fftw3.h,v 1.41 2003-01-19 01:23:12 stevenj Exp $ */
/* $Id: fftw3.h,v 1.42 2003-01-20 12:03:38 athena Exp $ */

#ifndef FFTW3_H
#define FFTW3_H
Expand Down Expand Up @@ -200,7 +200,9 @@ int X(import_wisdom)(int (*emitter)(void *), void *data); \
void X(print_plan)(X(plan) p, FILE *output_file); \
\
void *X(malloc)(size_t n); \
void X(free)(void *p);
void X(free)(void *p); \
\
void X(flops)(X(plan) p, int *add, int *mul, int *fma);

/* end of FFTW_DEFINE_API macro */

Expand Down
27 changes: 27 additions & 0 deletions api/flops.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2002 Matteo Frigo
* Copyright (c) 2002 Steven G. Johnson
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/

#include "api.h"

void X(flops)(X(plan) p, int *add, int *mul, int *fma)
{
opcnt *o = &p->pln->ops;
*add = o->add; *mul = o->mul; *fma = o->fma;
}
3 changes: 3 additions & 0 deletions tests/bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,11 @@ void setup(bench_problem *p)
BENCH_ASSERT(the_plan);

if (verbose > 1) {
int add, mul, fma;
FFTW(print_plan)(the_plan, stdout);
printf("\n");
FFTW(flops)(the_plan, &add, &mul, &fma);
printf("flops: %d add, %d mul, %d fma\n", add, mul, fma);
}
}

Expand Down

0 comments on commit 7a7f938

Please sign in to comment.