Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00021 #include <string.h>
00022 #include <iostream>
00023 #include <stdio.h>
00024 using std::cout;
00025
00026 #include "../SiftGPU/SiftGPU.h"
00027
00028
00029
00030
00031 int main(int argc, char** argv)
00032 {
00033
00034 if(argc >= 2 && strcmp(argv[1], "-server") == 0)
00035 {
00036
00037 std::cout << "Starting server process...\n";
00038 int port = 7777;
00039 if(argc >= 3) sscanf(argv[2], "%d", &port);
00041 RunServerLoop(port, argc - 3, argv + 3);
00042 }else if(argc >=2 && strcmp(argv[1], "-test") == 0)
00043 {
00044
00045
00046 SiftGPU* siftgpu = CreateRemoteSiftGPU();
00047 siftgpu->ParseParam(argc - 2, argv + 2);
00048 if(siftgpu->VerifyContextGL())
00049 {
00050
00051 siftgpu->RunSIFT("../data/800-1.jpg");
00052 siftgpu->RunSIFT("../data/800-2.jpg");
00053 }
00054 delete siftgpu;
00055 }else if(argc >=4 && strcmp(argv[1], "-test_remote") == 0)
00056 {
00058 char server_name[1024]; int port = 7777;
00059 strcpy(server_name, argv[2]);
00060 sscanf(argv[3], "%d", &port);
00061 SiftGPU* siftgpu = CreateRemoteSiftGPU(port, server_name);
00062 siftgpu->ParseParam(argc - 4, argv + 4);
00063 if(siftgpu->VerifyContextGL())
00064 {
00065
00066 siftgpu->RunSIFT("../data/800-1.jpg");
00067 siftgpu->RunSIFT("../data/800-2.jpg");
00068 }
00069 delete siftgpu;
00070 }else if(argc >=2 && strcmp(argv[1], "-test2") == 0)
00071 {
00072
00073
00074
00076
00077 SiftGPU* siftgpu1 = CreateRemoteSiftGPU(7777);
00078 SiftGPU* siftgpu2 = CreateRemoteSiftGPU(8888);
00079
00080
00081 int argc1 = 0, argc2 = 0;
00082 char** argv1 = argv + 2, **argv2 = 0;
00083 while(argc1 + 2 < argc && strcmp(argv[argc1 + 2], "-server2"))
00084 {
00085 argc1++;
00086 }
00087 if(argc1 + 3 < argc && strcmp(argv[argc1 + 2], "-server2") == 0)
00088 {
00089 argv2 = argv + argc1 + 3;
00090 argc2 = argc - argc1 - 3;
00091 }
00092
00093
00094 siftgpu1->ParseParam(argc1, argv1);
00095 siftgpu2->ParseParam(argc2, argv2);
00096 if(siftgpu1->VerifyContextGL() && siftgpu2->VerifyContextGL())
00097 {
00098 siftgpu1->RunSIFT("../data/800-1.jpg");
00099 siftgpu2->RunSIFT("../data/800-1.jpg");
00100 siftgpu1->RunSIFT("../data/800-2.jpg");
00101 siftgpu2->RunSIFT("../data/800-2.jpg");
00102 }
00103 delete siftgpu1;
00104 delete siftgpu2;
00105 }else
00106 {
00107 std::cout
00108 <<"try -test [siftgpu_param] to create a local server and a client\n"
00109 <<"try -test2 [siftgpu_param1] [-server2 [siftgpu_param2]]\n"
00110 <<" to create two servers and two clients\n"
00111 <<"try -test_remote remote_sever_name remote_server_port\n"
00112 <<" to create a client and connect to remote server\n"
00113 <<"use -server port [siftgpu_param] to start a server\n"
00114 <<"Note [siftgpu_param] allows you to select GPU from multi-GPUs\n"
00115 <<"\n";
00116 }
00117 return 1;
00118 }
00119