Skip to content

black_scholes test won't work. #276

Open
@anirul

Description

@anirul

Was running the test set and found out that black_scholes doesn't work on my laptop.

> ./black_scholes
device: HD Graphics 4000
libc++abi.dylib: terminating with uncaught exception of type boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::compute::context_error> >: OpenCL Build Warning : Compiler build log:
<program source>:1:7: warning: no previous prototype for function 'cnd'
float cnd(float d) [...]

Seams like the compiler on OSX need predeclaration to work, with predeclaration this seems to work:

diff --git a/example/black_scholes.cpp b/example/black_scholes.cpp
index e78e895..952d28d 100644
--- a/example/black_scholes.cpp
+++ b/example/black_scholes.cpp
@@ -69,6 +69,10 @@ int main()

     // source code for black-scholes program
     const char source[] = BOOST_COMPUTE_STRINGIZE_SOURCE(
+       
+               // some compiler need predeclaration
+               float cnd(float d);
+       
         // approximation of the cumulative normal distribution function
         float cnd(float d)
         {

Maybe you should not crash on warnings?

Nice work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions