Open MPI logo

MTT Devel Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all MTT Devel mailing list

Subject: Re: [MTT devel] MTT on Windows
From: Shiqing Fan (fan_at_[hidden])
Date: 2009-03-11 07:32:56


Hi Jeff,

That's an old patch, Here attatched is the new one.

I was just writing the email to be sent to MTT-devel, now I think it's
better to put it in this thread.

>> ===================================================================
>> --- lib/MTT/Common/GNU_Install.pm (revision 1271)
>> +++ lib/MTT/Common/GNU_Install.pm (working copy)
>> @@ -43,7 +43,45 @@
>> my $ret;
>> $ret->{test_result} = MTT::Values::FAIL;
>> $ret->{exit_status} = 0;
>> +
>> + if (`uname -o` == "Cygwin") {
>
> Can we think of a better test here? Will we always be running MTT
> under Cygwin?

On windows, there isn't any choice to run MTT in a linux-shell, another
option is MinGW, but I didn't try it. Personally, I think Cygwin is the
best choice, because it provides full Linux-like environment. Note that,
we use quite a lot Linux shell command in MTT, like df, uname, and so on.

So we can test like:
    if (`uname -o` == "Cygwin" ||
        `uname -o` == "MinGW" &&
        $config->{compiler_name} == "microsoft") {
        .....

Here in the new patch, I introduce the variable compiler_name, in order
to make it possible to use other compilers under Cygwin, e.g. gcc.

> Should this code rather be in a different .pm and the user selects
> which one to use via the .ini file?

Yes, that's also what I thought. Then we need to change a little in
upper level, e.g. OMPI.pm, we should test the environment and compiler,
in order to choose the right install module (Gnu_install.pm or
Win_install.pm maybe).

>> + if (exists($ENV{LD_LIBRARY_PATH})) {
>> + $ENV{LD_LIBRARY_PATH} =
>> "$config->{libdir}:$ENV{LD_LIBRARY_PATH}";
>> + } else {
>> + $ENV{LD_LIBRARY_PATH} = "$config->{libdir}";
>> + }
>> +
>> + # compile the whole solution
>> + $x = _do_step($config, "devenv.com OpenMPI.sln /build
>> debug", 1);
>> + %$ret = (%$ret, %$x);
>> + return $ret if
>> (!MTT::DoCommand::wsuccess($ret->{exit_status}));
>> +
>> + # install, not working yet
>
> What does this comment mean? ^^^

It remained unfixed in that patch. See the new one :-).

Thanks,
Shiqing

Index: lib/Filesys/DiskFree.pm
===================================================================
--- lib/Filesys/DiskFree.pm (revision 1271)
+++ lib/Filesys/DiskFree.pm (working copy)
@@ -29,6 +29,11 @@
         'inodes' => "df -Pi",
         'format' => "linuxish",
     },
+ 'cygwin' => {
+ 'blocks' => "df -P",
+ 'inodes' => "df -Pi",
+ 'format' => "linuxish",
+ },
     'solaris' => {
         'blocks' => "df -k",
         'inodes' => "df -k -o i -F ufs",
Index: lib/MTT/Common/GNU_Install.pm
===================================================================
--- lib/MTT/Common/GNU_Install.pm (revision 1271)
+++ lib/MTT/Common/GNU_Install.pm (working copy)
@@ -44,6 +44,51 @@
     $ret->{test_result} = MTT::Values::FAIL;
     $ret->{exit_status} = 0;
 
+ if (`uname -o` == "Cygwin" && $config->{compiler_name} == "microsoft") {
+ # On windows, do the following steps:
+ # [ ] cmake -G "generator" -D configure_arguments source_path
+ # [ ] devenv OpenMPI.sln /build
+
+ # prepare the windows style prefix.
+ # replace '/cygdrive/x/' with 'x:/'
+ my $win_prefix = substr ($config->{installdir},10,1) . ":" . substr ($config->{installdir},11);
+
+ # generate Visual Studio solution files
+ # use 'script' to redirect MS command output
+ $x = _do_step($config,
+ "script -a -c \"cmake $config->{configure_arguments} -D CMAKE_INSTALL_PREFIX:PATH=$win_prefix .\" -f temp.txt",
+ $config->{merge_stdout_stderr});
+
+ # Overlapping keys in $x override $ret
+ %$ret = (%$ret, %$x);
+ return $ret if (!MTT::DoCommand::wsuccess($ret->{exit_status}));
+
+ if (exists($ENV{LD_LIBRARY_PATH})) {
+ $ENV{LD_LIBRARY_PATH} = "$config->{libdir}:$ENV{LD_LIBRARY_PATH}";
+ } else {
+ $ENV{LD_LIBRARY_PATH} = "$config->{libdir}";
+ }
+
+ # compile the whole solution
+ $x = _do_step($config, "script -a -c \"devenv.com *.sln /build debug\" -f temp.txt",
+ $config->{merge_stdout_stderr});
+ %$ret = (%$ret, %$x);
+ return $ret if (!MTT::DoCommand::wsuccess($ret->{exit_status}));
+
+ # install to the prefix dir
+ $x = _do_step($config, "script -a -c \"devenv.com *.sln /project INSTALL.vcproj /build\" -f temp.txt",
+ $config->{merge_stdout_stderr});
+ %$ret = (%$ret, %$x);
+ return $ret if (!MTT::DoCommand::wsuccess($ret->{exit_status}));
+
+ # All done!
+ $ret->{test_result} = MTT::Values::PASS;
+ $ret->{result_message} = "Success";
+ Debug("Build was a success\n");
+
+ return $ret;
+ }
+
     # If the user does not use --prefix on their own, default
     # to $installdir
     my $prefix;
Index: lib/MTT/Defaults.pm
===================================================================
--- lib/MTT/Defaults.pm (revision 1271)
+++ lib/MTT/Defaults.pm (working copy)
@@ -39,7 +39,7 @@
     },
 
     known_compiler_names => [ "gnu", "pgi", "ibm", "intel", "kai", "absoft",
- "pathscale", "sun", "none", "unknown" ],
+ "pathscale", "sun", "microsoft", "none", "unknown" ],
     known_resource_manager_names => [ "slurm", "tm", "loadleveler", "n1ge",
                                       "alps", "none", "unknown" ],
     known_network_names => [ "tcp", "udp", "ethernet", "gm", "mx", "verbs",
Index: lib/MTT/MPI/Install/OMPI.pm
===================================================================
--- lib/MTT/MPI/Install/OMPI.pm (revision 1271)
+++ lib/MTT/MPI/Install/OMPI.pm (working copy)
@@ -76,6 +76,7 @@
     my $gnu = {
         configdir => $config->{configdir},
         configure_arguments => $config->{configure_arguments},
+ compiler_name => $config->{compiler_name},
         vpath => "no",
         installdir => $config->{installdir},
         bindir => $config->{bindir},