Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions conda-recipe/bld.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@rem Remember to activate compiler, if needed

set LIBROOT=%PREFIX%
set USE_OPENMP=1
%PYTHON% setup.py build --force install --old-and-unmanageable
if errorlevel 1 exit 1
5 changes: 5 additions & 0 deletions conda-recipe/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
if [ `uname` != Darwin ]; then
# currently intel-openmp does not work for osx
export USE_OPENMP=1
fi

LIBROOT=$PREFIX $PYTHON setup.py build install --old-and-unmanageable
21 changes: 15 additions & 6 deletions skipp/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,27 @@ def _get_sources_and_includes(dirs_list):

lib_root = os.environ['LIBROOT']

use_omp = True if 'USE_OPENMP' in os.environ else False

include_dir = [join(lib_root, 'include')]
library_dirs = [join(lib_root, 'lib')]
ipp_libraries = ["ippcv", "ippcore", "ippvm", "ipps", "ippi"]

_ipp_utils_dir = ['_ipp_utils']
_ipp_wr_dir = ['_ipp_wr']

if IS_LIN or IS_MAC:
extra_compile_args=['-fopenmp']
extra_link_args=['-fopenmp']
elif IS_WIN:
extra_compile_args=['-openmp']
extra_link_args=['-openmp']
extra_compile_args=[]
extra_link_args=[]
define_macros=[]

if(use_omp):
if IS_LIN or IS_MAC:
extra_compile_args.append('-fopenmp')
extra_link_args.append('-fopenmp')
elif IS_WIN:
extra_compile_args.append('-openmp')
extra_link_args.append('-openmp')
define_macros.append(('USE_OPENMP', None))

extension_names = [] # extension names and their dir names are the same
extension_cy_src = {}
Expand Down Expand Up @@ -124,6 +132,7 @@ def _get_sources_and_includes(dirs_list):
[extension_cy_src[extension_name]],
language="c",
libraries=ipp_libraries,
define_macros=define_macros,
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
include_dirs=include_dirs,
Expand Down
6 changes: 4 additions & 2 deletions skipp/transform/include/own_resize.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@
#ifndef RESIZE_H
#define RESIZE_H
#include <stddef.h>
#include "ipp.h"
#include <omp.h>
#include <ipp.h>
#ifdef USE_OPENMP
#include <omp.h>
#endif
#include "utils.h"

////////////////////////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 4 additions & 2 deletions skipp/transform/include/own_warp.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@
#ifndef WARP_H
#define WARP_H
#include <stddef.h>
#include "ipp.h"
#include <omp.h>
#include <ipp.h>
#ifdef USE_OPENMP
#include <omp.h>
#endif
#include "_ipp_wr.h"
#include "utils.h"

Expand Down
11 changes: 9 additions & 2 deletions skipp/transform/src/own_resize.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ own_Resize(
// image origin
int specSize = 0, initSize = 0, bufSize = 0; // Work buffer size

#ifdef USE_OPENMP
IppStatus * pStatus = NULL;
IppiBorderSize borderSize = {0, 0, 0, 0};
int numThreads, slice, tail;
int bufSize1, bufSize2;
Expand All @@ -107,7 +109,7 @@ own_Resize(
}
#endif

IppStatus * pStatus = NULL;
#endif

// checking supported dtypes
if (!(ippDataType==ipp8u ||
Expand Down Expand Up @@ -218,7 +220,7 @@ own_Resize(
status = ippStsErr;
}
check_sts(status);

#ifdef USE_OPENMP
if (max_num_threads != 1)
{
status = ippiResizeGetBorderSize(ippDataType, pSpec, &borderSize);
Expand Down Expand Up @@ -317,6 +319,7 @@ own_Resize(
}
else
{
#endif
status = ippiResizeGetBufferSize(ippDataType, pSpec, dstSize,
numChannels, &bufSize);
check_sts(status);
Expand Down Expand Up @@ -345,10 +348,14 @@ own_Resize(
status = ippStsErr;
}
check_sts(status);
#ifdef USE_OPENMP
}
#endif
EXIT_FUNC
ippsFree(pSpec);
ippsFree(pBuffer);
#ifdef USE_OPENMP
ippFree(pStatus);
#endif
return status;
}
13 changes: 10 additions & 3 deletions skipp/transform/src/own_warp.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
//
////////////////////////////////////////////////////////////////////////////////////////
#include "own_warp.h"
#include "omp.h"

#define EXIT_FUNC exitLine: /* Label for Exit */
#define check_sts(st) if((st) != ippStsNoErr) goto exitLine
Expand Down Expand Up @@ -86,11 +85,13 @@ own_Warp(
// source/destination images

int specSize = 0, initSize = 0, bufSize = 0; // Work buffer size
IppiPoint dstOffset = { 0, 0 };

#ifdef USE_OPENMP
IppStatus * pStatus = NULL;
int numThreads, slice, tail;
int bufSize1, bufSize2;
IppiSize dstTileSize, dstLastTileSize;
IppiPoint dstOffset = { 0, 0 };

int max_num_threads;

Expand All @@ -104,7 +105,7 @@ own_Warp(
}
#endif

IppStatus * pStatus = NULL;
#endif

// checking supported dtypes
if (!(ippDataType==ipp8u ||
Expand Down Expand Up @@ -181,6 +182,7 @@ own_Warp(
}
check_sts(status);

#ifdef USE_OPENMP
if (max_num_threads != 1)
{
// General transform function
Expand Down Expand Up @@ -259,6 +261,7 @@ own_Warp(
}
else
{
#endif
status = ippiWarpGetBufferSize(pSpec, dstSize, &bufSize);
check_sts(status);
pBuffer = ippsMalloc_8u(bufSize);
Expand All @@ -269,12 +272,16 @@ own_Warp(
}
status = _ippiWarpAffine_interpolation(ippDataType, interpolation, numChannels,
pSrc, srcStep, pDst, dstStep, dstOffset, dstSize, pSpec, pBuffer);
#ifdef USE_OPENMP
}
#endif

EXIT_FUNC
ippsFree(pInitBuf);
ippsFree(pSpec);
ippsFree(pBuffer);
#ifdef USE_OPENMP
ippFree(pStatus);
#endif
return status;
}