On Mar 11, 2009, at 7:32 AM, Shiqing Fan wrote:

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


Ah, excellent.

> 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") {
        .....


Good point. I see that your new patch doesn't test for MinGW -- should it?

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",

Do you need MinGW in this patch? ^^^


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") {

Per above, do we need MinGW in this test? ^^


+        # 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}));

I missed this the first time -- don't you need to restore %ENV here?

+
+        # 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;
+    }
+

I think I would be more comfortable separating this stuff into a Cmake.pm or somesuch. After all, it's *not* a configure/make (i.e., GNU tools) build. I think the default should call the GNU install process, but if you set ompi_cmake = 1 (or somesuch), then call your module/routine instead of the GNU one. For example:

    my $install;
    if ($config->{ompi_cmake}) {
        $install = MTT::Common::Cmake::Install($gnu);
    } else {
        $install = MTT::Common::GNU_Install::Install($gnu);
    }

Just curious -- does the OMPI cmake system also work on Linux? I ask because your cmake process is fairly win-specific. If it's *only* intended to work on windoze, perhaps we should add some if tests to it that warn/error if you're *not* running on cygwin/mingw (this is only relevant if/when the cmake stuff moves to its own .pm file).

Make sense?

    # 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},
<ATT4352636.txt>

All this looks good. ^^

--
Jeff Squyres
Cisco Systems

Reply via email to