<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel rdf:about="https://community.wolfram.com">
    <title>Community RSS Feed</title>
    <link>https://community.wolfram.com</link>
    <description>RSS Feed for Wolfram Community showing any discussions tagged with gridMathematica with no replies sorted by active.</description>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2903058" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/930286" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/616290" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/587691" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/515112" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/372280" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/165103" />
      </rdf:Seq>
    </items>
  </channel>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2903058">
    <title>Processor group awareness</title>
    <link>https://community.wolfram.com/groups/-/m/t/2903058</link>
    <description>Mathematica 13.2 is still not processor group aware, i.e. able to utilize multiple NUMA nodes on a single machine.  More and more of today&amp;#039;s CPU&amp;#039;s are exceeding 32 physical cores (64 logical), not to mention dual CPU workstations that are quite common in high performance settings.  Windows does not allow more than 64 logical processors in a single processor group, which means Mathematica cannot access the remaining processing power -- also apparent when you check $ProcessorCount.  The current workaround is to disable hyperthreading/SMT which only raises the ceiling to 64 physical processors, but it is less than ideal and poor solution for dual CPU systems.  Are there plans or methods to make Mathematica processor group aware?  Not sure if there&amp;#039;s any real technical difficulty in allowing different subkernels to be launched on different processor groups.  I know that 3rd party tools such as Process Lasso can work but it would be better for Mathematica to have this ability natively.</description>
    <dc:creator>Sheldon Wu</dc:creator>
    <dc:date>2023-04-21T06:40:22Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/930286">
    <title>Make use of multi cores on a single node of supercomputer &amp;#039;Stampede&amp;#039;?</title>
    <link>https://community.wolfram.com/groups/-/m/t/930286</link>
    <description>Hi everone,&#xD;
I am using Mathematica 10.4 in GUI mode on stampede supercomputer. I am using a single node on this machine and each node has two 8 core chips. Whenever I try to parallelize my code on 16 cores(using only one node) by launching kernels, it does not allow me and continue to compute the solution on a single core. The $ProcessorCount command showed me that there is only one processor. If on each node there are two 8 core chips that it should show me 8 or 16. I cannot figure out a way to connect all cores on one node. If anyone knows about it, please let me know asap.&#xD;
Thanks&#xD;
ashu</description>
    <dc:creator>Ashu  Sharma</dc:creator>
    <dc:date>2016-09-26T20:55:54Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/616290">
    <title>LibraryLink Example with OpenCV from Macports</title>
    <link>https://community.wolfram.com/groups/-/m/t/616290</link>
    <description>Recently [Macports][1] is gaining more attention from the open source community on the Mac platform. It has a build for OpenCV which is every intuitive to install in terminal. Here is the package info of this OpenCV port: &#xD;
&#xD;
    $ port info opencv&#xD;
    opencv @3.0.0_1 (graphics, science)&#xD;
    Variants:             contrib, dc1394, debug, eigen, java, opencl, openni, python27, python34, qt4, qt5, tbb,&#xD;
                          universal, vtk&#xD;
    &#xD;
    Description:          OpenCV is a library that is mainly aimed at real time computer vision. Some example&#xD;
                          areas would be Human-Computer Interaction (HCI), Object Identification, Segmentation and&#xD;
                          Recognition, Face Recognition, Gesture Recognition, Motion Tracking, Ego Motion, Motion&#xD;
                          Understanding, Structure From Motion (SFM), and Mobile Robotics.&#xD;
    Homepage:             http://opencv.org&#xD;
    &#xD;
    Extract Dependencies: unzip&#xD;
    Build Dependencies:   cmake, pkgconfig&#xD;
    Library Dependencies: zlib, bzip2, libpng, jpeg, jasper, tiff, ilmbase, openexr, ffmpeg&#xD;
    Platforms:            darwin&#xD;
    License:              BSD&#xD;
    Maintainers:          stromnov@macports.org, openmaintainer@macports.org&#xD;
&#xD;
Usually default install location is `/opt/local/`. We use the `image_external` example from [this link][2] and the original source code is from &#xD;
&#xD;
    /Applications/Mathematica.app/Contents/SystemFiles/Links/LibraryLink/LibraryResources/Source/image_external.c&#xD;
&#xD;
assuming you have the default mathematica installation on the Mac machine.&#xD;
&#xD;
 First we load the `LibraryLink` and `CCompilerDriver`&#xD;
&#xD;
    Needs[&amp;#034;LibraryLink`&amp;#034;]&#xD;
    Needs[&amp;#034;CCompilerDriver`&amp;#034;]&#xD;
&#xD;
I put a modified version of the source code in the same directory as the working notebook (`image_extern2.c` contains some type casting of `cvCreateImage -&amp;gt; ImageData` which returns a `char *`)&#xD;
&#xD;
Load the path to the source file: &#xD;
&#xD;
    In[3]:= sourcePath=NotebookDirectory[]&#xD;
    Out[3]= /Users/shenghuiyang/Desktop/opencv_Mathematica/&#xD;
&#xD;
To build this file, we have 2 options. First, we can use the `CreateLibrary` function: &#xD;
&#xD;
    lib=CreateLibrary[{FileNameJoin[{sourcePath,&amp;#034;image_extern2.c&amp;#034;}]},&amp;#034;image_external&amp;#034;,&#xD;
    &amp;#034;IncludeDirectories&amp;#034; -&amp;gt; {&#xD;
    &amp;#034;/opt/local/include&amp;#034;, &#xD;
    &amp;#034;/opt/local/include/opencv&amp;#034;, &#xD;
    &amp;#034;/opt/local/include/opencv2/imgproc&amp;#034;, &#xD;
    &amp;#034;/opt/local/include/libraw&amp;#034;&#xD;
    }, &#xD;
     &amp;#034;LibraryDirectories&amp;#034; -&amp;gt; {&amp;#034;/opt/local/lib&amp;#034;}, &#xD;
     &amp;#034;Libraries&amp;#034; -&amp;gt; { &amp;#034;opencv_core&amp;#034;, &amp;#034;opencv_highgui&amp;#034;,&amp;#034;opencv_imgproc&amp;#034;, &amp;#034;raw&amp;#034;},&#xD;
     &amp;#034;Debug&amp;#034;-&amp;gt;False&#xD;
    ];&#xD;
&#xD;
The key to use this function with Macports&amp;#039;s OpenCV (and `libra`) is to set the proper directories. Use the following command in the terminal to find them&#xD;
&#xD;
    pkg-config --cflags --libs opencv&#xD;
    pkg-config --cflags --libs libraw&#xD;
&#xD;
One thing to note is that the actual file of these libraries are `libopencv_core` and so on. You should omit the `lib` before the file name on OS X. Load the dynamic library with `LibraryFunctionLoad` function&#xD;
&#xD;
    opencvDilate = &#xD;
     LibraryFunctionLoad[lib, &#xD;
      &amp;#034;opencv_dilate&amp;#034;, {{LibraryDataType[Image], &amp;#034;Constant&amp;#034;}, &#xD;
       Integer}, {LibraryDataType[Image]}]&#xD;
&#xD;
The second method is to use a `makefile` to build the dynamic library first and use the `LibaryFunctionLoad` to call the name of the library directly. &#xD;
&#xD;
    CC = clang&#xD;
    TargetLocation = /Users/shenghuiyang/Library/Mathematica/SystemFiles/LibraryResources/MacOSX-x86-64&#xD;
    &#xD;
    $(shell rm $(TargetLocation)/image_external.dylib)&#xD;
    &#xD;
    SOURCE=image_extern2.c&#xD;
    OBJECTS =image_external.dylib &#xD;
    &#xD;
    CFLAGS =...&#xD;
    &#xD;
    IFLAGS = ...&#xD;
    FRAMEWORKFLAGS =...&#xD;
    LIBDIR = -L/opt/local/lib&#xD;
    LIBFLAGS = -lopencv_core -lopencv_highgui -lopencv_imgproc&#xD;
    LIBFLAGS += -lraw -lstdc++ -lstdc++&#xD;
    &#xD;
    Target = image_external.dylib&#xD;
    &#xD;
    $(TargetLocation)/image_external.dylib:$(SOURCE)&#xD;
    	$(CC) -dynamiclib -o $(TargetLocation)/image_external.dylib $(CFALGS) $(FRAMEWORKFLAG) $(IFLAGS) $(SOURCE) $(LIBDIR) $(LIBFLAGS) 2&amp;gt;&amp;amp;1&#xD;
&#xD;
How do I know this file works? Well I called `CreateLibrary` with this option in `ShellCommandFunction `: &#xD;
&#xD;
    lib=CreateLibrary[{FileNameJoin[{sourcePath,&amp;#034;image_extern2.c&amp;#034;}]},&amp;#034;image_external&amp;#034;,&#xD;
    &amp;#034;IncludeDirectories&amp;#034; -&amp;gt; {...},&#xD;
    &amp;#034;ShellCommandFunction&amp;#034;-&amp;gt;Print&#xD;
    ];&#xD;
    /usr/bin/clang -dynamiclib -o &amp;#034;/Users/shenghuiyang/Library/Mathematica/SystemFiles/LibraryResources/MacOSX-x86-64/Working-shenghuiy-37929-2049441792-2/image_external.dylib&amp;#034; -m64 -fPIC -O2 -mmacosx-version-min=10.6 -framework Foundation  -I&amp;#034;/Applications/Mathematica.app/Contents/SystemFiles/IncludeFiles/C&amp;#034; -I&amp;#034;/Applications/Mathematica.app/Contents/SystemFiles/Links/MathLink/DeveloperKit/MacOSX-x86-64/CompilerAdditions&amp;#034; -I&amp;#034;/opt/local/include&amp;#034; -I&amp;#034;/opt/local/include/opencv&amp;#034; -I&amp;#034;/opt/local/include/opencv2/imgproc&amp;#034; -I&amp;#034;/opt/local/include/libraw&amp;#034; &amp;#034;/Users/shenghuiyang/Desktop/opencv_Mathematica/image_extern2.c&amp;#034;  -F&amp;#034;/Applications/Mathematica.app/Contents/SystemFiles/Links/MathLink/DeveloperKit/MacOSX-x86-64/CompilerAdditions&amp;#034; -L&amp;#034;/opt/local/lib&amp;#034;  -framework &amp;#034;mathlink&amp;#034; -l&amp;#034;opencv_core&amp;#034; -l&amp;#034;opencv_highgui&amp;#034; -l&amp;#034;opencv_imgproc&amp;#034; -l&amp;#034;raw&amp;#034; -lstdc++ 2&amp;gt;&amp;amp;1&#xD;
&#xD;
You can download the `makefile` in the attachment. After this makefile is executed, the `.dylib` is transferred to a member of `$LibraryPath` automatically. Then we can load this library with &#xD;
&#xD;
    opencvDilate=LibraryFunctionLoad[&amp;#034;image_external&amp;#034;,&amp;#034;opencv_dilate&amp;#034;,{{LibraryDataType[Image],&amp;#034;Constant&amp;#034;},Integer},{LibraryDataType[Image]}]&#xD;
&#xD;
Finally you can use the opencvDilate function in Mathematica directly as the following screenshot. In a very similar way we can load the `readRawImage` to load the `.arw` file into Mathematica (about 60MB in size)&#xD;
&#xD;
![enter image description here][3]&#xD;
&#xD;
&#xD;
  [1]: https://www.macports.org&#xD;
  [2]: https://reference.wolfram.com/language/LibraryLink/tutorial/ImageProcessing.html&#xD;
  [3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2015-11-18at1.11.32AM.png&amp;amp;userId=23928</description>
    <dc:creator>Shenghui Yang</dc:creator>
    <dc:date>2015-11-18T07:16:01Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/587691">
    <title>gridMathematica Server, Ligthweight Grid Manager 10</title>
    <link>https://community.wolfram.com/groups/-/m/t/587691</link>
    <description>Hello,&#xD;
&#xD;
I cannot find any reference Ligthweight Grid Manager can be installed on Mathematica 10. &#xD;
&#xD;
In Wolfram Site, there is just installation guide for version 9 not version 10.&#xD;
&#xD;
gridMathematica is just for expanding the computing kernel, but it is hard to setup RemoteKernel manually.&#xD;
&#xD;
So I think Ligthweight Grid Manager is easy-to-use. &#xD;
&#xD;
Please let me know if Lightweight Grid Manager can be installed on Version 10.&#xD;
&#xD;
Thanks,&#xD;
&#xD;
Jiwon</description>
    <dc:creator>jiwon hwang</dc:creator>
    <dc:date>2015-10-22T02:33:04Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/515112">
    <title>trouble making batch to run mathematica</title>
    <link>https://community.wolfram.com/groups/-/m/t/515112</link>
    <description>I am having issues trying to create a batch file to run math.exe . I am running this as a windows batch file&#xD;
&#xD;
 In the batch file I run math -initfile test.m, I only get math kernel command prompt, ready to accept inputs, with no reaction to my .m file, like this&#xD;
In[1]:&#xD;
&#xD;
how do I get it to run the commands?&#xD;
&#xD;
I followed this post and still no joy:&#xD;
&#xD;
http://mathematica.stackexchange.com/questions/47977/running-a-notebook-with-a-batch-file</description>
    <dc:creator>David Sheetz</dc:creator>
    <dc:date>2015-06-17T18:08:08Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/372280">
    <title>Entering numbers and brackets - interpolation</title>
    <link>https://community.wolfram.com/groups/-/m/t/372280</link>
    <description>...</description>
    <dc:creator>Martin Kralovec</dc:creator>
    <dc:date>2014-10-18T19:02:26Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/165103">
    <title>Some tips about using gridMathematica over a Mixed Network</title>
    <link>https://community.wolfram.com/groups/-/m/t/165103</link>
    <description>This post demonstrates some basic techniques to help the gridMathematica users to use their own clusters over different networks. A typical example is a mixture of home LAN and a VPN to your remote location. 

[b]1. Installation[/b]

Detailed information about Installation is covered [url=http://reference.wolfram.com/mathematica/LightweightGridManager/tutorial/Overview.html]here[/url]. Just make sure that you install the [i]gridMathematica[/i] with a user name of low privilage so you won&amp;#039;t be able to modify important locations like /usr/bin or windows/system32

[b]2. Test [/b]

Once services are started on each node, you can [url=http://reference.wolfram.com/mathematica/LightweightGridManager/tutorial/WebInterface.html#262527504]check the[i] localhost:3737[/i] of each slave machine[/url]. You should have admin password to activate the licenses. gridMathematica server won&amp;#039;t be working properly until license is activated.  

[b]3. Work on the distributed system[/b]

To have a full control of the net work in terms of the Mathematica process, I recommand the build-in package and utility function. 
In this case, the master machine is my macbook pro. There is no problem as I work with two Windows nodes. Every piece of data is transferred via web packet so it is OS independent . 
[center][img=width: 385px; height: 69px;]/c/portal/getImageAttachment?filename=master.png&amp;amp;userId=23928[/img][/center]
 I load the &amp;#034;LightweightGridClient&amp;#034; package, which comes with Mathematica by default.
[mcode]Needs[&amp;#034;LightweightGridClient`&amp;#034;][/mcode]
The package is fairly rich. You can find a bundle of useful utitlity functions here. 
[mcode]Names[&amp;#034;LightweightGridClient`*&amp;#034;] // TableForm[/mcode][center][img=width: 266px; height: 259px;]/c/portal/getImageAttachment?filename=utilities.png&amp;amp;userId=23928[/img][/center]If your DNS is correctly setup over the network, you should be able to launch the subkernels directly with the host name of the nodes. If you have some issue, in general, you can edit the hosts file on your master machine to include the ip address and the host name of the same machine. Search online to find the location of this file based on the OS.  

It is always a good idea to check the connectivity in case of launching kernels with chunk of error messages. I use the following functions to check the configuration of the distributed system. &amp;#034;shenghui-pc&amp;#034; is a machine in my home network while &amp;#034;shenghuiywin&amp;#034; is the machine in the VPN domain. To make sure the two machines are recognizable by the master node, I added the full domain name for the machine in VPN to indicate that it is a machine in a network different from that for &amp;#034;shenghui-pc&amp;#034;.
 [mcode]agent1 = RemoteServicesAgentInformation[&amp;#034;shenghui-pc&amp;#034;]
agent2 = RemoteServicesAgentInformation[&amp;#034;shenghuiywin.my.vpn.domain&amp;#034;][/mcode]
Simple as the result, the two output are objects containing  useful set-up information for each grid server, among which the most important are ContactURL and DefaultKernelCommand. The first indicates the location of the machine online and the latter tells me where the executable on the device. 
 
[img=width: 800px; height: 549px;]/c/portal/getImageAttachment?filename=config.png&amp;amp;userId=23928[/img]

You can launch kernel via the following command. The name of the options are straightforward, which are defined with [url=http://reference.wolfram.com/mathematica/LightweightGridClient/tutorial/Introduction.html]LightweightGrid[/url] function
[img=width: 686px; height: 271px;]/c/portal/getImageAttachment?filename=config2.png&amp;amp;userId=23928[/img]
If you want to also launch the kernels on the master machine, you can simply put a number in the list. 
[mcode]kernels = LaunchKernels[{
    4, 
    LightweightGrid[{&amp;#034;Agent&amp;#034; -&amp;gt; &amp;#034;shenghui-pc&amp;#034;, &amp;#034;KernelCount&amp;#034; -&amp;gt; 4}],
    LightweightGrid[{&amp;#034;Agent&amp;#034; -&amp;gt; &amp;#034;shenghuiywin.my.vpn.domain&amp;#034;, 
      &amp;#034;KernelCount&amp;#034; -&amp;gt; 4}]
    }];[/mcode]
here 4 simply tells the master kernel to launch 4 subkernels on the local machine. 

[b]4. Use MathLink to assign parallel jobs[/b]

This is a technique that is useful if you have computational heavy task for subkernels and you still want to work in the same session. Otherwise you may have to wait until a result is returned from a function like ParallelEvaluate. 

Pick up a subkernel from the list of link objects

[mcode]link2Subkeners=Cases[
Links[],
LinkObject[x_,_,_]/;StringMatchQ[x,RegularExpression[&amp;#034;\\d{4,5}&amp;#034;]~~__](*pick subkernels&amp;#039; link only*)
]//TableForm [/mcode]
Do manual [url=http://reference.wolfram.com/mathematica/ref/LinkWrite.html?q=LinkWrite&amp;amp;lang=en]LinkWrite[/url] and [url=http://reference.wolfram.com/mathematica/ref/LinkRead.html?q=LinkRead&amp;amp;lang=en]LinkRead[/url] on LAN: 
[mcode]link = LinkObject[&amp;#034;53802@192.168.2.2,53803@192.168.2.2&amp;#034;, 211, 7];
LinkWrite[link, Unevaluated[Pause[5]; FactorInteger[2^32 - 3]]][/mcode]
Comparing to ParallelEvaluate, you can work within the same notebook during the evaluation. You can pick up the result at any time after, in my case ,5 second computation time by 
[mcode]LinkRead[link][/mcode]
You may verify my observation by yourself : (cell brackets will be highlighted for about 5 seconds) 
[mcode]ParallelEvaluate[Pause[5]; FactorInteger[2^32 - 3], 1][/mcode]
MathLink is very flexible and you can also work on functions that require FrontEnd: 
[mcode]LinkWriteHeld[link, 
 Hold[Image[ {{0, 63, 127, 191, 255}, {0, 50, 100, 150, 200}}, 
   &amp;#034;Byte&amp;#034;]]][/mcode][img=width: 298px; height: 111px;]/c/portal/getImageAttachment?filename=10213res.png&amp;amp;userId=23928[/img]

Eventually, do not forget to close kernels at the end of the evaluation: 
[mcode]CloseKernels[] // TableForm
[/mcode]
Note: This type of network is excellent for parallelization with big chunk of computation. The limit is latency and bandwith (LAN is much faster than VPN, while the latter determines the overall time). Therefore, it is not recommended to use ParallelSubmit which cause speed down due to many submission over the network if tasks are rather small.</description>
    <dc:creator>Shenghui Yang</dc:creator>
    <dc:date>2013-12-04T03:34:51Z</dc:date>
  </item>
</rdf:RDF>

