DeinoMPI Forum

Forum dedicated to discussing DeinoMPI
Welcome to DeinoMPI Forum Sign in | Join | Help
in Search

compiling with Dev-C++

Last post 01-27-2010, 9:38 AM by runsun. 5 replies.
Sort Posts: Previous Next
  •  05-18-2007, 1:14 PM 154

    compiling with Dev-C++

    Hello,

    A newbie question:

    I have installed DeinoMPI, and added the include, lib paths to Dev-C++ options.

    The problem is that I get linker errors and when trying to compile with gcc. I know I have to compile with mpi.lib.. What is the correct parameter to add to DevCpp compiler options? Everything that I have tried did not work..

    Thank you in advance

  •  05-18-2007, 9:21 PM 155 in reply to 154

    Re: compiling with Dev-C++

    I downloaded Dev-C++ 4.9.9.2 and created a console application in c:\temp\DevCPP.  You can only compile C appications.  If you want to use the C++ interface then you must use the Microsoft Visual C++ compiler.  Here are the two files used to successfully compile an MPI application using Dev-C++:

    Here is main.c:

    #include <mpi.h>
    #include <stdio.h>
    #include <stdlib.h>

    int main(int argc, char *argv[])
    {
        int rank, size;
       
        MPI_Init(&argc, &argv);
        MPI_Comm_rank(MPI_COMM_WORLD, &rank);
        MPI_Comm_size(MPI_COMM_WORLD, &size);
       
        printf("I am %d of %d\n", rank, size);
        fflush(stdout);
       
        MPI_Finalize();
        return 0;
    }

    Here is mpi_sample.dev:

    [Project]
    FileName=mpi_sample.dev
    Name=mpi_sample
    UnitCount=1
    Type=1
    Ver=1
    ObjFiles=
    Includes="C:\Program Files\DeinoMPI\include"
    Libs="C:\Program Files\DeinoMPI\lib"
    PrivateResource=
    ResourceIncludes=
    MakeIncludes=
    Compiler=
    CppCompiler=
    Linker="../../Program Files/DeinoMPI/lib/mpi.lib"_@@_
    IsCpp=0
    Icon=
    ExeOutput=
    ObjectOutput=
    OverrideOutput=0
    OverrideOutputName=mpi_sample.exe
    HostApplication=
    Folders=
    CommandLine=
    UseCustomMakefile=0
    CustomMakefile=
    IncludeVersionInfo=0
    SupportXPThemes=0
    CompilerSet=0
    CompilerSettings=0000000000000000000000

    [Unit1]
    FileName=main.c
    CompileCpp=0
    Folder=
    Compile=1
    Link=1
    Priority=1000
    OverrideBuildCmd=0
    BuildCmd=

    [VersionInfo]
    Major=0
    Minor=1
    Release=1
    Build=1
    LanguageID=1033
    CharsetID=1252
    CompanyName=
    FileVersion=
    FileDescription=Developed using the Dev-C++ IDE
    InternalName=
    LegalCopyright=
    LegalTrademarks=
    OriginalFilename=
    ProductName=
    ProductVersion=
    AutoIncBuildNr=0

     

  •  05-19-2007, 1:45 AM 156 in reply to 155

    Re: compiling with Dev-C++

    Thank you very much! Keep up the good work!
  •  10-09-2007, 11:40 AM 179 in reply to 155

    Re: compiling with Dev-C++

    Hi,
    Have you try doing this same in C++?
    I created a c++ projcet, linked both cxx.lib and mpi.lib.

    But during compilation of the following code:


    #include mpicxx.h
    #include cstdlib
    #include iostream

    using namespace std;

    int main(int argc, char *argv[])
    {
    int rank, size;

    MPI_Init(&argc, &argv);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &size);

    cout "Hello, I am " rank ". Size = " size endl;

    MPI_Finalize();
    return 0;
    }

    I've got lot of errors.

    Thanks for any suggestions.

    Sorry for my english:P
  •  10-18-2007, 1:43 AM 182 in reply to 179

    Re: compiling with Dev-C++

    Include mpi.h and mpicxx.h will be included for you.  This code compiled and ran for me:

    #include "mpi.h"

    #include <cstdlib>

    #include <iostream>

    using namespace std;

    int main(int argc, char *argv[])

    {

    int rank, size;

    MPI_Init(&argc, &argv);

    MPI_Comm_rank(MPI_COMM_WORLD, &rank);

    MPI_Comm_size(MPI_COMM_WORLD, &size);

    cout << "Hello, I am " << rank << ". Size = " << size << endl;

    MPI_Finalize();

    return 0;

    }

  •  01-27-2010, 9:38 AM 319 in reply to 154

    Re: compiling with Dev-C++

    Hi,
    In your .dev file, you change the following values:
    Includes="...\MPICH2\include"
    Libs="...\MPICH2\lib"
    ...
    Linker="...\MPICH2\lib\mpi.lib"

    Here, "...\" should be your actual directory for mpich.

    However, I have a related question:
    Whenever I create a new project in Dev-C++, I have to change the .dev file again (add Includes, Libs, and Linker) for mpi. Is there an efficient way to do that?
    It seemed that you added these in Dev-C++ options. Could you show me how you did?
    Thanks.

    rs
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems