Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6322

Re: nVidia Optumus prevents using CUDA?

From "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: nVidia Optumus prevents using CUDA?
Date 2011-11-10 11:56 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j9ge5m$oqe$1@smc.vnet.net> (permalink)
References <j8nuj1$ee5$1@smc.vnet.net> <j8r9hu$3jk$1@smc.vnet.net>

Show all headers | View raw


On Wed, 09 Nov 2011 11:34:14 -0000, Alexander Vorobiev  
<alexander.vorobiev@removethis.gmail.com> wrote:

> "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> writes:
>
>> Personally, I use MinGW-w64 GCC
>> 4.6.1 rather than Visual C++; this works perfectly well also but does
>> require modifications to Mathematica which I will not discuss here other
>> than to say that it would be nice if this compiler could be supported
>> without need of modifications in a future release.
>
> The way to deal with MinGW-w64 is described in the documentaion.  
> Specifically,
> either define $CCompiler:
>
> Needs["CCompilerDriver`"]
>
> Needs["CCompilerDriver`GenericCCompiler`"]
>
> $CCompiler = {"Name" -> "MinGW64", "Compiler" -> GenericCCompiler,
>    "CompilerInstallation" -> "C:/MinGW64",
>    "CompilerName" -> "x86_64-w64-mingw32-gcc.exe"};
>
> or use the options, e.g.
>
> greeter = CreateExecutable[StringJoin[
>    "#include <stdio.h>\n",
>    "int main(){\n",
>    "  printf(\"Hello MinGW-w64 world.\\n\");\n",
>    "}\n"],
>   "hiworld", "Compiler" -> GenericCCompiler,
>   "CompilerInstallation" -> "C:/MinGW64",
>   "CompilerName" -> "x86_64-w64-mingw32-gcc.exe"]
>

Treating MinGW-w64 as a generic compiler as described in the documentation  
gives one the ability to call it from Mathematica, but does not enable the  
same level of functionality available with compilers for which proper  
support has been provided. For example, apart from the CUDA issue you  
noticed, nothing using MathLink or the Wolfram Library runtime will work  
either because libraries have not been provided for this.  
CCompilerDriver`GenericCCompiler.m avoids link errors only because it does  
not attempt to link with any libraries. In other words, the approach  
suggested in the documentation achieves only barely minimal support and is  
not enough for proper operation. For example:

In[1]:=
Needs["CCompilerDriver`"];

In[2]:=
(* With proper support *)
$CCompiler=CCompilerDriver`MinGWCompiler`MinGWCompiler;
CreateLibrary[
{"C:\\Program Files\\Wolfram  
Research\\Mathematica\\8.0\\SystemFiles\\Links\\LibraryLink\\LibraryResources\\Source\\demo_mathlink.c"},"demo_mathlink"
]

Out[3]=
"C:\\Users\\Oleksandr\\Application  
Data\\Mathematica\\SystemFiles\\LibraryResources\\Windows-x86-64\\demo_mathlink.dll"

In[4]:=
(* Using GenericCCompiler` as suggested in the documentation *)
$CCompiler={"Name"->"MinGW64","Compiler"->CCompilerDriver`GenericCCompiler`GenericCCompiler,"CompilerInstallation"->"C:\\MinGW-w64","CompilerName"->"x86_64-w64-mingw32-gcc.exe"};
CreateLibrary[
{"C:\\Program Files\\Wolfram  
Research\\Mathematica\\8.0\\SystemFiles\\Links\\LibraryLink\\LibraryResources\\Source\\demo_mathlink.c"},"demo_mathlink",
"ShellOutputFunction"->Print
]

During evaluation of In[5]:=
C:\MinGW-w64\bin\x86_64-w64-mingw32-gcc.exe -shared -o  
"C:\Users\Oleksandr\Application  
Data\Mathematica\SystemFiles\LibraryResources\Windows-x86-64\Working\demo_mathlink.dll"  
-I"C:\Program Files\Wolfram  
Research\Mathematica\8.0\SystemFiles\IncludeFiles\C" -I"C:\Program  
Files\Wolfram  
Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\CompilerAdditions\mldev64\include"  
"C:\Program Files\Wolfram  
Research\Mathematica\8.0\SystemFiles\Links\LibraryLink\LibraryResources\Source\demo_mathlink.c"  
-L"C:\Program Files\Wolfram  
Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\CompilerAdditions\mldev64\lib"  
-L"C:\Program Files\Wolfram  
Research\Mathematica\8.0\SystemFiles\Libraries\Windows-x86-64" 2>&1
C:\Users\Oleksandr\Temp\ccCKP9sc.o:demo_mathlink.c:(.text+0x54): undefined  
reference to `MLCheckFunction'
C:\Users\Oleksandr\Temp\ccCKP9sc.o:demo_mathlink.c:(.text+0x70): undefined  
reference to `MLGetInteger'
C:\Users\Oleksandr\Temp\ccCKP9sc.o:demo_mathlink.c:(.text+0x84): undefined  
reference to `MLGetInteger'
C:\Users\Oleksandr\Temp\ccCKP9sc.o:demo_mathlink.c:(.text+0x94): undefined  
reference to `MLNewPacket'
C:\Users\Oleksandr\Temp\ccCKP9sc.o:demo_mathlink.c:(.text+0xb7): undefined  
reference to `MLPutInteger'
C:\Users\Oleksandr\Temp\ccCKP9sc.o:demo_mathlink.c:(.text+0x1bc):  
undefined reference to `MLCheckFunction'
C:\Users\Oleksandr\Temp\ccCKP9sc.o:demo_mathlink.c:(.text+0x1d8):  
undefined reference to `MLGetString'
C:\Users\Oleksandr\Temp\ccCKP9sc.o:demo_mathlink.c:(.text+0x1e8):  
undefined reference to `MLNewPacket'
C:\Users\Oleksandr\Temp\ccCKP9sc.o:demo_mathlink.c:(.text+0x20c):  
undefined reference to `MLPutString'
C:\Users\Oleksandr\Temp\ccCKP9sc.o:demo_mathlink.c:(.text+0x23f):  
undefined reference to `MLReleaseString'
collect2: ld returned 1 exit status

Out[5]= $Failed

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

nVidia Optumus prevents using CUDA? DmitryG <einschlag@gmail.com> - 2011-11-01 05:03 +0000
  Re: nVidia Optumus prevents using CUDA? DmitryG <einschlag@gmail.com> - 2011-11-02 11:24 +0000
  Re: nVidia Optumus prevents using CUDA? "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-11-02 11:29 +0000
    Re: nVidia Optumus prevents using CUDA? DmitryG <einschlag@gmail.com> - 2011-11-03 08:48 +0000
    Re: nVidia Optumus prevents using CUDA? "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-11-04 11:00 +0000
      Re: nVidia Optumus prevents using CUDA? DmitryG <einschlag@gmail.com> - 2011-11-10 12:07 +0000
    Re: nVidia Optumus prevents using CUDA? "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-11-07 11:03 +0000
    Re: nVidia Optumus prevents using CUDA? Alexander Vorobiev <alexander.vorobiev@removethis.gmail.com> - 2011-11-09 11:34 +0000
    Re: nVidia Optumus prevents using CUDA? "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-11-10 11:56 +0000
    Re: nVidia Optumus prevents using CUDA? DmitryG <einschlag@gmail.com> - 2011-11-11 09:55 +0000
    Re: nVidia Optumus prevents using CUDA? "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-11-12 12:39 +0000

csiph-web