Difference between revisions of "Support:Tech notes"

From COMKAT wiki
Jump to navigation Jump to search
m
(Reverted edits by Thomasdelange (talk) to last revision by Bucks)
 
(38 intermediate revisions by 19 users not shown)
Line 1: Line 1:
http://mimilla.com/
+
== Mex and compiler setting ==
 +
==== How to set up mex  compiler on a 64-bit Matlab using Visual Studio 2008 Professional ====
 +
# I was using Visual Studio 2008 Profession that is free for college students. I believe 2008 Express works the same way, too.
 +
# When you install Visual Studio 2008, I recommend to install 'Full' so that you are sure the 64-bit compilers and libraries are installed.
 +
# Go to Download, uncompress and copy the x64 mex option files under the MATLABROOT\bin\win64\mexopts.
 +
# Do a mex -setup. Let Matlab locate the installed compiler. Select "Microsoft Visual C++ 2008".
 +
# Use mex command to compile a simple file. You get the following error
 +
<pre>
 +
C:\PROGRA~1\MATLAB\R2007B\BIN\MEX.PL: 
 +
Error: Using options file:
 +
        C:\Users\deancool\AppData\Roaming\MathWorks\MATLAB\R2007b\mexopts.bat
 +
        You cannot use this file with the WIN64 architecture because it enables
 +
        a compiler for a different architecture.
 +
        Running mex -setup may resolve this problem.  
  
We are a community where you can find latest SEO tips and tricks, lists of active random niche DoFollow, CommentLuv and KeywordLuv blogs with high PR, some PREMIUM stuff like .EDU blog list, WordPress premium plugins, free gift cards giveaways and much more! Enjoy and stay updated with us, anytime, anywhere!
+
</pre>
[[http://baovevn.vn/cong-ty-tu-van-nghiep-vu-bao-ve/ cong ty bao ve]]
+
<p>To fix this error:
[[http://www.cuudulieu24h.com cuu du lieu]]
+
# Locate your mexopts.bat file. Edit the following lines:
[[http://noithathoangduy.com.vn noithat]]
+
## Line 17 (set PATH): add '\amd64' after ''set PATH=%VCINSTALLDIR%\BIN\''
[[http://ihrp.fis.com.vn/ Phần mềm nhân sự]]
+
## Line 19 (set LIB): add '\amd64' after ''set LIB=%VCINSTALLDIR%\ATLMFC\LIB'' and ''%VCINSTALLDIR%\LIB''. Add '\x64' after ''C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib''
[[http://ihrp.fis.com.vn/ Quản lý Nhân sự]]
+
## Line 20: set MW_TARGET_ARCH=win'''64'''
[[http://ihrp.fis.com.vn/ Phần mềm quản lý nhân sự tiền lương]]
+
## Line 34: set LIBLOC=%MATLAB%\extern\lib\win'''64'''\microsoft
[[http://thamtuthanglong.com/ tham tu]]
+
## Line 36: /MACHINE:'''X64'''
[[http://thamtuthanglong.com/ cong ty tham tu]]
+
 
[[http://uvc-thanhlapcongty.com/dang-ky-online/dang-ky-thanh-lap-doanh-nghiep.html thành lập doanh nghiệp]]
+
NOTE: Environment - Windows Vista 64-bit, Matlab 2007b 64-bit.
[[http://uvc-thanhlapcongty.com/cung-cap-dich-vu/dich-vu-ke-toan.html dịch vụ kế toán]]
+
 
[[http://uvc-thanhlapcongty.com/cung-cap-dich-vu/dich-vu-ke-toan.html dich vu ke toan]]
+
My mexopts.bat file: [[Image:Mexopts.zip]]
[[http://www.chiemhoa.vn/ ke sieu thi]]
+
 
[[http://www.chiemhoa.vn/ quay ke]]\
+
==== How to set up the C compiler from Visual Studio 2008 on a 64-bit Windows system ====
<span class="plainlinks">[http://www.frenchdoorshq.com/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">french doors</span>]
+
# Go to control->system->environmental variables. Edit 'path' and add the following dir: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64
<span class="plainlinks">[http://www.frenchdoorshq.com/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">french door</span>]
+
# Go to control->system->environmental variables. Edit 'LIB' and add the following dir: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\amd64
<span class="plainlinks">[http://www.frenchdoorshq.com/category/exterior-french-doors/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">exterior french doors</span>]
+
Or go to C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64 and run vcvarsamd64.bat
<span class="plainlinks">[http://www.frenchdoorshq.com/category/exterior-french-doors/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">exterior french door</span>]
+
 
<span class="plainlinks">[http://www.frenchdoorshq.com/category/interior-french-doors/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">interior french doors</span>]
+
== How to compile cvOdesGenMod5.c ==
<span class="plainlinks">[http://www.frenchdoorshq.com/category/interior-french-doors/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">interior french door</span>]
+
==== Windows ====
<span class="plainlinks">[http://donkoontzdds.com/cosmetic-dentistry/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">cosmetic dentist washington</span>]
+
1. Enter COMKATROOT\CVODESserial-2.3.0-2005\sundials\cvodes\source. Run:
<span class="plainlinks">[http://donkoontzdds.com/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">dentists everett wa</span>]
+
<pre>cl /c /I..\include /I..\..\shared\include *.c
<span class="plainlinks">[http://donkoontzdds.com/cosmetic-dentistry/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">cosmetic dentistry washington</span>]
+
lib /out:cvodes.lib *.obj</pre>
<span class="plainlinks">[http://donkoontzdds.com/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">everett dental</span>]
+
Copy cvodes.lib to the COMKATROOT\lib\win64 folder (change win64 according to your system)
<span class="plainlinks">[http://donkoontzdds.com/cosmetic-dentistry/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">washington cosmetic dentistry</span>]
+
2. Enter COMKATROOT\CVODESserial-2.3.0-2005\sundials\shared\source. Run:
<span class="plainlinks">[http://www.hollymariejewelry.com/bracelets-c-10 <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">personalized photo necklaces</span>]
+
<pre>cl /c /I..\include  *.c
<span class="plainlinks">[http://www.hollymariejewelry.com/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">picture jewelry</span>]
+
lib /out:sundials.lib *.obj</pre>
<span class="plainlinks">[http://www.hollymariejewelry.com/necklaces-c-9 <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">mom jewelry</span>]
+
Copy sundials.lib to the COMKATROOT\lib\win64 folder (change win64 according to your system)
<span class="plainlinks">[http://www.hollymariejewelry.com/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">photo jewelry</span>]
+
3. Enter COMKATROOT\CVODESserial-2.3.0-2005\sundials\nvec_ser. Run
<span class="plainlinks">[http://www.hollymariejewelry.com/rings-c-11 <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">personalized rings</span>]
+
<pre>cl /c /I..\shared\include  *.c
<span class="plainlinks">[http://www.hollymariejewelry.com/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">personalized jewelry</span>]
+
lib /out:nvec_ser.lib *.obj</pre>
<span class="plainlinks">[http://www.hollymariejewelry.com/bracelets-c-10 <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">personalized bracelets</span>]
+
Copy nvec_ser.lib to the COMKATROOT\lib\win64 folder (change win64 according to your system)
<span class="plainlinks">[http://www.hollymariejewelry.com/bracelets-c-10 <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">customized bracelets</span>]
+
 
<span class="plainlinks">[http://www.hollymariejewelry.com/necklaces-c-9 <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">photo pendant necklace</span>]
+
 
<span class="plainlinks">[http://www.huntingtexastrophies.com/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">trophy hunting</span>]
+
==== Linux ====
<span class="plainlinks">[http://www.huntingtexastrophies.com/texas-hunting-packages/texas-whitetail-deer-hunting/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">deer hunting</span>]
+
NOTE: Under 64-bit Ubuntu and 64-bit Matlab, you have to do the following changes to make the mex compilation work.
<span class="plainlinks">[http://www.huntingtexastrophies.com/texas-hunting-packages/fallow-deer-hunting/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">fallow deer hunting</span>]
+
# Edit the mexopts.sh and remove all ''-lstdc++''
<span class="plainlinks">[http://www.huntingtexastrophies.com/texas-hunting-packages/sika-deer-hunting/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">sika deer hunting</span>]
+
# Edit the cvodesGenmod5.c. Find function 'clear' and remove the 'static' declaration.
<span class="plainlinks">[http://www.huntingtexastrophies.com/texas-hunting-packages/fallow-deer-hunting/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">Texas fallow deer hunting</span>]
+
# When you use gcc to compile, add a flag '-fPIC'.
<span class="plainlinks">[http://www.huntingtexastrophies.com/texas-hunting-packages/mouflon-sheep-hunting/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">mouflon sheep hunting</span>]
+
 
<span class="plainlinks">[http://www.huntingtexastrophies.com/texas-hunting-packages/texas-whitetail-deer-hunting/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">trophy whitetail deer hunting</span>]
+
== How to prepare a COMKAT release ==
<span class="plainlinks">[http://www.huntingtexastrophies.com/texas-hunting-packages/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">Texas hunting packages</span>]
+
<br>
 +
<br>
 +
 
 +
== CCIR-specific settings for MATLAB distributed computing server ==
 +
 
 +
As the server is installed on the 123 subnets, clients on the 125 subnets will not be able to connect to the job manager unless the following modification is made:
 +
 
 +
1. On the client side, edit the file 'hosts' and add a line
 +
 
 +
<THE SERVER IP ADDRESS> <SERVER NAME>
 +
 
 +
such as:
 +
 +
123.456.78.9 HEADNODE
 +
 
 +
Contact Dean or Dr. Muzic to get the right information.
 +
 
 +
The 'hosts' file can be found at '/etc/' in Macs and '/Windows/System32/drivers/etc/' in Windows-based PCs.
 +
 
 +
2. On the server side, edit the 'hosts' file. Do the same thing to add the ip and computer name of the client to this file.
 +
 
 +
3. Now the findResource command should work without any problem.
 +
 
 +
== MATLAB Compiler ==
 +
==== Weird behavior of path settings for compiled MATLAB applications ===
 +
__
 +
For example, compiled main_GUI.m under ''c:\comkat\comkat_GUI\'' and set the output directory to be ''c:\compiled_dir\''.
 +
Before being compiled, the output to which('main_GUI') returns:
 +
<pre>c:\comkat\comkat_GUI\</pre>
 +
After being compiled, the same command returns:
 +
<pre>c:\compiled_dir\main_GUI_mcr\main_GUI\</pre>
 +
You have to be careful because if you are calling another function, for example, loadModelTemplate.m from main_GUI. If the directory is not switched, there should not be a problem. But if you switch to the directory of main_GUI.m, different behavior happens.
 +
<br>The commands executed are:
 +
<pre>cd(fileparts(which('main_GUI')))
 +
x = loadModelTemplate</pre>
 +
Under MATLAB, x will be returned properly; However, under compiled MATLAB application, it returns:
 +
<pre> Undefined function or variable 'loadModelTemplate'</pre>
 +
 
 +
The reason is that, under compiled MATLAB applications, ''fileparts(which('main_GUI'))'' returns the directory of '''c:\compiled_dir\main_GUI_mcr\main_GUI\''' that contains all the encrypted m-files. Once you switch to this folder, although you will find a file called loadModelTemplate, or function won't be able to be called. The command exist('loadModelTemplate') returns
 +
<pre>0</pre>
 +
You would have to exit this folder in order to call this function.
 +
<br>Therefore, if you do use which and cd to find files and enter a certain directory, it is recommended that you do it this way:
 +
<pre>if ~isdeployed
 +
    cd(fileparts(which('main_GUI')))
 +
end</pre>
 +
So that you don't run into errors...
 +
 
 +
== uitable errors when deployed ==
 +
For MATLAB 2008a and earlier, uitable errors when it is compiled with Matlab Compiler.

Latest revision as of 14:46, 7 September 2012

Mex and compiler setting

How to set up mex compiler on a 64-bit Matlab using Visual Studio 2008 Professional

  1. I was using Visual Studio 2008 Profession that is free for college students. I believe 2008 Express works the same way, too.
  2. When you install Visual Studio 2008, I recommend to install 'Full' so that you are sure the 64-bit compilers and libraries are installed.
  3. Go to Download, uncompress and copy the x64 mex option files under the MATLABROOT\bin\win64\mexopts.
  4. Do a mex -setup. Let Matlab locate the installed compiler. Select "Microsoft Visual C++ 2008".
  5. Use mex command to compile a simple file. You get the following error
C:\PROGRA~1\MATLAB\R2007B\BIN\MEX.PL:  
Error: Using options file: 
         C:\Users\deancool\AppData\Roaming\MathWorks\MATLAB\R2007b\mexopts.bat 
         You cannot use this file with the WIN64 architecture because it enables 
         a compiler for a different architecture. 
         Running mex -setup may resolve this problem. 

To fix this error:

  1. Locate your mexopts.bat file. Edit the following lines:
    1. Line 17 (set PATH): add '\amd64' after set PATH=%VCINSTALLDIR%\BIN\
    2. Line 19 (set LIB): add '\amd64' after set LIB=%VCINSTALLDIR%\ATLMFC\LIB and %VCINSTALLDIR%\LIB. Add '\x64' after C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib
    3. Line 20: set MW_TARGET_ARCH=win64
    4. Line 34: set LIBLOC=%MATLAB%\extern\lib\win64\microsoft
    5. Line 36: /MACHINE:X64

NOTE: Environment - Windows Vista 64-bit, Matlab 2007b 64-bit. My mexopts.bat file: File:Mexopts.zip

How to set up the C compiler from Visual Studio 2008 on a 64-bit Windows system

  1. Go to control->system->environmental variables. Edit 'path' and add the following dir: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64
  2. Go to control->system->environmental variables. Edit 'LIB' and add the following dir: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\amd64

Or go to C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64 and run vcvarsamd64.bat

How to compile cvOdesGenMod5.c

Windows

1. Enter COMKATROOT\CVODESserial-2.3.0-2005\sundials\cvodes\source. Run:

cl /c /I..\include /I..\..\shared\include *.c
lib /out:cvodes.lib *.obj

Copy cvodes.lib to the COMKATROOT\lib\win64 folder (change win64 according to your system) 2. Enter COMKATROOT\CVODESserial-2.3.0-2005\sundials\shared\source. Run:

cl /c /I..\include  *.c
lib /out:sundials.lib *.obj

Copy sundials.lib to the COMKATROOT\lib\win64 folder (change win64 according to your system) 3. Enter COMKATROOT\CVODESserial-2.3.0-2005\sundials\nvec_ser. Run

cl /c /I..\shared\include  *.c
lib /out:nvec_ser.lib *.obj

Copy nvec_ser.lib to the COMKATROOT\lib\win64 folder (change win64 according to your system)


Linux

NOTE: Under 64-bit Ubuntu and 64-bit Matlab, you have to do the following changes to make the mex compilation work.

  1. Edit the mexopts.sh and remove all -lstdc++
  2. Edit the cvodesGenmod5.c. Find function 'clear' and remove the 'static' declaration.
  3. When you use gcc to compile, add a flag '-fPIC'.

How to prepare a COMKAT release



CCIR-specific settings for MATLAB distributed computing server

As the server is installed on the 123 subnets, clients on the 125 subnets will not be able to connect to the job manager unless the following modification is made:

1. On the client side, edit the file 'hosts' and add a line

<THE SERVER IP ADDRESS> <SERVER NAME>

such as:

123.456.78.9 HEADNODE

Contact Dean or Dr. Muzic to get the right information.

The 'hosts' file can be found at '/etc/' in Macs and '/Windows/System32/drivers/etc/' in Windows-based PCs.

2. On the server side, edit the 'hosts' file. Do the same thing to add the ip and computer name of the client to this file.

3. Now the findResource command should work without any problem.

MATLAB Compiler

= Weird behavior of path settings for compiled MATLAB applications

__ For example, compiled main_GUI.m under c:\comkat\comkat_GUI\ and set the output directory to be c:\compiled_dir\. Before being compiled, the output to which('main_GUI') returns:

c:\comkat\comkat_GUI\

After being compiled, the same command returns:

c:\compiled_dir\main_GUI_mcr\main_GUI\

You have to be careful because if you are calling another function, for example, loadModelTemplate.m from main_GUI. If the directory is not switched, there should not be a problem. But if you switch to the directory of main_GUI.m, different behavior happens.
The commands executed are:

cd(fileparts(which('main_GUI')))
x = loadModelTemplate

Under MATLAB, x will be returned properly; However, under compiled MATLAB application, it returns:

 Undefined function or variable 'loadModelTemplate'

The reason is that, under compiled MATLAB applications, fileparts(which('main_GUI')) returns the directory of c:\compiled_dir\main_GUI_mcr\main_GUI\ that contains all the encrypted m-files. Once you switch to this folder, although you will find a file called loadModelTemplate, or function won't be able to be called. The command exist('loadModelTemplate') returns

0

You would have to exit this folder in order to call this function.
Therefore, if you do use which and cd to find files and enter a certain directory, it is recommended that you do it this way:

if ~isdeployed
     cd(fileparts(which('main_GUI')))
end

So that you don't run into errors...

uitable errors when deployed

For MATLAB 2008a and earlier, uitable errors when it is compiled with Matlab Compiler.