Software Archive
Read-only legacy content
17061 Discussions

Using COI creating a new process on host

Qiang_L_
Beginner
308 Views

Hi,

I am using COI programming model on Xeon phi. I can start a process on Xeon phi from host successfully, But I can not start a process on host from host or start a process on host from Xeon phi. For examople, when I want to start process on host from host my code is as follows:

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

#include <source/COIProcess_source.h>
#include <source/COIEngine_source.h>

int main()
{

    COIRESULT result = COI_ERROR;

    COIPROCESS proc;
    COIENGINE engine;
    unsigned int num_engines = 0;
   const char *SINK_NAME0 = "connect";

    result0 = COIEngineGetCount(COI_ISA_x86_64, &num_engines);//instead of using COI_ISA_MIC
    if(result0!=COI_SUCCESS)
    {
        printf("COIEngineGetCount result %s\n",    COIResultGetName(result0));
        return -1;
    }
    if(num_engines<1)
    {
        printf("Error: Need at least 1 engine!\n");
        return -1;
    }

    printf("the total engines num is %d\n",num_engines);

    result0 = COIEngineGetHandle(COI_ISA_x86_64,0,&engine0);//instead of using COI_ISA_MIC flag
    if(result0!=COI_SUCCESS)
    {
        printf("COIEngineGetHandle result0 %s\n",COIResultGetName(result0));
        return -1;
    }
    else
        printf("COIEngineGetHandle0 success!\n");

    result0 = COIProcessCreateFromFile(engine0,
                                        SINK_NAME0,
                                        0,NULL,
                                        0,NULL,
                                        1,NULL,
                                        0,
                                        NULL,
                                        &proc0
        );
        if(result0!=COI_SUCCESS)
        {
                printf ("COIProcessCreateFromFile result %s\n",COIResultGetName (result0));

                return -1;
        }
        else
                printf("COIProcessCreateFromFile success!\n");

}

and on the sink side(here I use Xeon CPU not Xeon Phi as sink device), I just write a simple code , compiled to a binary which name is "connect".when I run the program, I can get the number of engine is 1, and  getenginehandler also sucess, but COIProcessCreateFromFile return error which is COI_NOT_INITIALIZED. I do not know whether it is possible to do that in principle? and I also do not know know whether it is possible to start a process on host from Xeon phi in principle? If it is possible, how to achieve that? Does anyone has any COI programming experience?

 

Thank you!

Qiang

0 Kudos
2 Replies
Sunny_G_Intel
Employee
308 Views

Hello Qiang,

In order to successfully run COI applications it is required that you have a coi_daemon up and running on both the source and the sink. So can you please verify if the coi_daemon is running on both source and sink. I haven't tried an example where x86_64 host is setup to work as both source and sink. So in case you have the coi_daemon setup properly and you still find issues to offload to sink then I can investigate further if that is even possible. In case it is possible then I would be happy to help you find a know method to achieve that setup.

Thanks

0 Kudos
Sunny_G_Intel
Employee
308 Views

Hello Qiang,

After further investigation I can conclude that reverse acceleration (i.e. using coprocessor as a source and host as a sink) and using host as both the source and sink are not supported with COI API. 

Thanks

0 Kudos
Reply