Qt: CUDA with Qt OSX Yosemite "sed: illegal option - r" error

I am creating a simple app with Qt creator in which I want to use CPU and GPU calculations to complete a task and then compare the execution times in m / s.

I read a lot of articles and came to the conclusion that I need to separate the NVCC and GCC compilers from each other to avoid conflict. I followed this tutorial while making settings for my system, however, when I compile, I get a strange error:

sed: illegal option -- r
usage: sed script [-Ealn] [-i extension] [file ...]
       sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
make: *** [gaussian_cuda.o] Error 1
14:42:46: The process "/usr/bin/make" exited with code 2.

      

Obviously the error is being inferred from this line in my config .pro

:

2>&1 | sed -r \"s/\\(([0-9]+)\\)/:\\1/g\" 1>&2

      

I don't understand why this is an illegal operation and when I try to delete this line my code breaks completely.

Why r

is it illegal?

EDIT Full configuration code:

QT       += core gui
QT       += multimedia
QT       += multimediawidgets
QT       += concurrent

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = WebcamFilter
TEMPLATE = app

SOURCES += main.cpp\
           mainwindow.cpp \
           camerafeed.cpp \

HEADERS  += mainwindow.h \
            camerafeed.h

FORMS    += mainwindow.ui

# CUDA Resources
CUDA_SOURCES += gaussian.cu
CUDA_DIR      = /usr/local/cuda
# Path to header and lib files
INCLUDEPATH  += $$CUDA_DIR/include
QMAKE_LIBDIR += $$CUDA_DIR/lib
# Libs used for source code
LIBS         += -lcudart -lcuda
# GPU Architecture
CUDA_ARCH     = sm_20
# Custom flags for nvcc
NVCCFLAGS     = --compiler-options -fno-strict-aliasing -use_fast_math --ptxas-options=-v
# Prepare extra compiler configuration
CUDA_INC      = $$join(INCLUDEPATH,' -I','-I',' ')
cuda.commands = $$CUDA_DIR/bin/nvcc -m64 -O3 -arch=$$CUDA_ARCH -c $$NVCCFLAGS \
                $$CUDA_INC $$LIBS  ${QMAKE_FILE_NAME} -o ${QMAKE_FILE_OUT} \
                2>&1 | sed -r \"s/\\(([0-9]+)\\)/:\\1/g\" 1>&2
cuda.dependency_type = TYPE_C
cuda.depend_command  = $$CUDA_DIR/bin/nvcc -O3 -M $$CUDA_INC $$NVCCFLAGS   ${QMAKE_FILE_NAME}

cuda.input = CUDA_SOURCES
cuda.output = ${OBJECTS_DIR}${QMAKE_FILE_BASE}_cuda.o
# Tell Qt that we want add more stuff to the Makefile
QMAKE_EXTRA_COMPILERS += cuda

      

+3


source to share


1 answer


As Park Young-Bae suggested, Mac is sed

not equivalent GNU sed

and so the flag is:

2>&1 | sed -r \"s/\\(([0-9]+)\\)/:\\1/g\" 1>&2

      

it was necessary to change:



2>&1 | sed -E \"s/\\(([0-9]+)\\)/:\\1/g\" 1>&2

      

This fixed the problem.

+5


source







All Articles