OpenCV with CUDA on Mac OS 10.6.7 - macos

I'm trying to build OpenCV 2.2 with CUDA on my mac (using Mac OS 10.6.7 and Xcode 4). I followed the instructions on the opencv wiki, but it doesn't seem to work.
First of all, I can't find the NPP for the 3.2 version of the CUDA toolkit. I've tried then using the 4.0 version (even though it is not yet stable). The structure of the NPP directories is completely different than that assumed by the CMake script shipped with OpenCV. I've tried adapting it so that that it would find the NPP.
Apparently it had worked, except that when I build OpenCV on Xcode, I generate every library except gpu.
Has someone tried and was successful when trying to build OpenCV with CUDA on Mac OSX?
Thanks,
Renan

install cuda 4
then go to...
$ cd /developer/gpu computing/
build samples and libs.....
$ make
$ open /OpenCV-2.3.0/modules/gpu/CMakeLists.txt
go to line #48 and comment out this if statement....
//if (APPLE)
//set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;-fno-finite-math-only;")
//endif()
now you should be able to compile gpu libs.
basically your getting rid of the 3.2 no NPP exception.
you could enable exceptions like this....
if (APPLE)
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;/EHsc-;")
endif()
my gnu tests where faster negating the apple statement.

Related

how does compilation work exactly on os x

I just started getting into LLVM and clang compilers and the whole thing. I am following the book "Getting started with llvm core libraries". I was under the impression that OS X comes bundled with llvm. However it seems that is not the case. I need to install llvm separately to get command line tools like llc or lli.
So my question is, when I do a "clang" to compile my c/c++ code, what backend does the work of creating the machine code ? My installation shows commands like llvm-gcc and llvm-g++ . Does it mean that it uses gcc internally for creating machine code? And do i need to brew install llvm to switch completely to llvm ?
If you just want clang, and plan to do mostly high-level language development (C, C++, ObjC), then I recommend installing the Xcode command line tools. You can get those from https://developer.apple.com/downloads/index.action?name=for%20Xcode (or you can install all of Xcode if you prefer).
If you want lower-level tools like llc, then my recommendation is brew, as you suggest.
If you're goal is just Mac development, then Xcode is the better solution. If your goal is working on LLVM, then brew is the better answer (or pull the sources and build it yourself).
If you want both on the same machine, I'd recommend not installing the command line tools. Just install Xcode and LLVM. Then you can run the Xcode versions using xcrun without colliding with your LLVM installation.
clang doesn't use llvm-gcc as a backend. It includes LLVM. llvm-gcc is a modified version of GCC that integrates with the LLVM backend, which allows programs that expect GCC-specific features to work with LLVM.

Desperately trying to build open source tools (octave) on a Mac 10.6 Snow Leopard (involves Xcode, gcc, fink)

The ironic thing is that all this used to work on my Mac, but Apple no longer supports 10.5.8, so I was forced to update to Snow Leopard, 10.6. And everything broke (thank you Apple).
On the surface, it seems simple. Build an open source package like octave under Snow Leopard (Mac OS X 10.6)
Apple has made this difficult, to say the least. They no longer download XCode for older operating systems unless you are a paid developer. My Macbook pro 2.16Ghz cannot load Lion, so that option is not available.
My old fink doesn't work because it was old. In order to build a new one, I need Xcode 3.2, which I can't get (see above).
I downloaded a free gcc 4.2, and it works fine.
So in order to try to build octave, it's the old style gnu install:
./configure
make
make install
./configure fails because there is no fortran installed. That's a special case because the install of gcc didn't include fortran. So a fallback would be building a complete gcc which I have done in the past.
downloaded gcc 4.9:
gcc-4.9-20130728
inside, gcc49
gcc can't build because it needs the three subsidiary packages gmp, mpfr and mpc
I am now trying to build these, so that I can bootstrap a complete gcc build, but in the meantime, is there any simpler way to bootstrap these things? I find it hard to understand why no binaries are available for:
fink
octave
which would solve part of my current problems.
You can still get XCode. You just have to be registered on Apple Developer, but you do not have to pay for the license. You then download it through the Mac App store, or you can get a link that opens it in the App store here. Finally, you have to install the command line tools from within Xcode. These can be found under the Components tab of the Download Preferences panel.
Let me know if that does not help. My iMac running 10.6 is currently in for repairs, so I am on my 10.7 laptop and cannot test all the specifics yet.

Installing openCV on Lion OS 10.7.4 Xcode 4.3.2

I'm trying to install openCV on university's iMac,
but the problem is our university's network is so strict.
and I couldn't install openCV using MacPorts.
I tried google to look for a way to install but it all failed
i guess because it is kind of old ways and because my network is so strict.
So if anybody knows a way that I can download a ready framework with how to use it inside
Xcode. or at least a framework with how to install it to work with Xcode.
or a way to download from the source and compile it then install it in Xcode
please.
Because I tried the cmake way and I still have no luck to get it work.
thanks in advance.
sources I used:
http://salemsayed.me/?p=240
http://opencv.willowgarage.com/wiki/InstallGuide
http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Port
http://www.ient.rwth-aachen.de/cms/software/opencv/
I'm using Lion + Xcode 4.x branch, with OpenCV svn trunk. Everything works fine. You have to install cmake first, then get the code from the svn following the instructions at http://code.opencv.org . The compilation process worked fine for me for all the core modules + the Qt module + the GPU module + TBB acceleration.
The instructions are the same as the Linux platform.
After setting up cmake configuration in a terminal (using ccmake for a more interactive tool),
I set the architecture to x86_64 (on my MBP Core 2 Duo), the target directory to /usr/local/(the default), and I have Intel TBB installed in /usr/local/.
Cmake generates the makefiles for you, so you just have to type make -j2 to compile, then sudo make install. If you're working on a workstation, then you have more CPU power, and you can replace the value 2 by more, e.g. 8.

Installing dph-examples in Mac OS X 10.7.2

I am trying to install dph-examples in mac os x version 10.7.2 and I got this error. How ever on ghci , I can see
ghci>import Data.Array.Parallel.
Data.Array.Parallel.Base Data.Array.Parallel.Base.DTrace Data.Array.Parallel.Base.TracePrim Data.Array.Parallel.Stream
but not Data.Array.Parallel , Data.Array.Parallel.Prelude and Data.Array.Parallel.Prelude.Double. I copied the example ( it uses these libraries ) given on Data-Parallel-Haskell and its working fine. My program is compiling and running so my question is, why i am not able to see these library at ghci prompt. Also i am not able to find the reference for sumP function at the Data-Array-Parallel. I am using ghc-7.2.1.
GHC depends on Xcode 3.2:
The package requires Xcode 3.2 (in particular, the "Unix Development Support") to be already installed.
— GHC 7.2.1 download page
Xcode 3.2 should already come with LLVM, so if it's not already installed, installing it should fix things. If you already have it installed, then your installation might be broken somehow; you could try reinstalling it to make sure. I think Xcode 4 isn't fully supported by GHC yet, so if you have it installed, that might be the problem; you could try uninstalling it and installing 3.2 instead.
Warning: Couldn't figure out LLVM version!
Make sure you have installed LLVM
Perhaps you didn't install LLVM? Go install LLVM.

qmake QT 4.6 application with no XCode project in Mac OS X?

I've downloaded the source for KardsGT, which is written for I think QT 4.6.x onto my Mac OS X 10.6.8 system.
Since KardsGT is not written specifically for Mac OS X (it was meant for GNU/Linux), there is no associated XCode files, etc. When I run qmake on the source, I get lots of error like
WARNING: Ignored (not found) '/src/kardsgt-0.7.1/src/players/players-debug.xcodeproj'
It seems that qmake is thinking I am using XCode for this project? How do I correct this so the code will compile? (I've tried qmake -unix but that didn't change the results)
You do not need Xcode to compile a Qt program. Just run
$ qmake -config release
$ make clean
$ make
and you should be good to go (if the sources do not use any Linux-specific stuff).

Resources