Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPP build in pure cmake #3021

Merged
merged 25 commits into from
Apr 16, 2024
Merged

CPP build in pure cmake #3021

merged 25 commits into from
Apr 16, 2024

Conversation

mreso
Copy link
Collaborator

@mreso mreso commented Mar 13, 2024

Description

This PR refactors the build process to run in pure cmake instead of a build.sh.

Fixes #(issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Feature/Issue validation/testing

See: https://github.com/pytorch/serve/actions/runs/8276214879

make test
Running tests...
Test project /home/ubuntu/serve/cpp/build
        Start   1: strip_flags_help
  1/100 Test   #1: strip_flags_help ...................................................   Passed    0.01 sec
        Start   2: unittest
  2/100 Test   #2: unittest ...........................................................   Passed    0.01 sec
        Start   3: help-reporting
  3/100 Test   #3: help-reporting .....................................................   Passed    0.01 sec
        Start   4: long-helpstring
  4/100 Test   #4: long-helpstring ....................................................   Passed    0.01 sec
        Start   5: changed_bool1
  5/100 Test   #5: changed_bool1 ......................................................   Passed    0.01 sec
        Start   6: changed_bool2
  6/100 Test   #6: changed_bool2 ......................................................   Passed    0.01 sec
        Start   7: changeable_string_var
  7/100 Test   #7: changeable_string_var ..............................................   Passed    0.01 sec
        Start   8: nohelp
  8/100 Test   #8: nohelp .............................................................   Passed    0.01 sec
        Start   9: help=false
  9/100 Test   #9: help=false .........................................................   Passed    0.01 sec
        Start  10: helpfull
 10/100 Test  #10: helpfull ...........................................................   Passed    0.01 sec
        Start  11: helpshort
 11/100 Test  #11: helpshort ..........................................................   Passed    0.01 sec
        Start  12: helpshort-tldflag1
 12/100 Test  #12: helpshort-tldflag1 .................................................   Passed    0.01 sec
        Start  13: helpshort-tldflag2
 13/100 Test  #13: helpshort-tldflag2 .................................................   Passed    0.01 sec
        Start  14: helpshort-main
 14/100 Test  #14: helpshort-main .....................................................   Passed    0.01 sec
        Start  15: helpshort_main
 15/100 Test  #15: helpshort_main .....................................................   Passed    0.01 sec
        Start  16: helpon
 16/100 Test  #16: helpon .............................................................   Passed    0.01 sec
        Start  17: helpon=gflags
 17/100 Test  #17: helpon=gflags ......................................................   Passed    0.01 sec
        Start  18: helpon_gflags
 18/100 Test  #18: helpon_gflags ......................................................   Passed    0.01 sec
        Start  19: helpon=gflags_unittest
 19/100 Test  #19: helpon=gflags_unittest .............................................   Passed    0.01 sec
        Start  20: helpmatch_reporting
 20/100 Test  #20: helpmatch_reporting ................................................   Passed    0.01 sec
        Start  21: helpmatch=unittest
 21/100 Test  #21: helpmatch=unittest .................................................   Passed    0.01 sec
        Start  22: helpmatch=nosuchsubstring
 22/100 Test  #22: helpmatch=nosuchsubstring ..........................................   Passed    0.01 sec
        Start  23: helpon=nosuchmodule
 23/100 Test  #23: helpon=nosuchmodule ................................................   Passed    0.01 sec
        Start  24: helppackage
 24/100 Test  #24: helppackage ........................................................   Passed    0.02 sec
        Start  25: helpxml
 25/100 Test  #25: helpxml ............................................................   Passed    0.01 sec
        Start  26: version-1
 26/100 Test  #26: version-1 ..........................................................   Passed    0.01 sec
        Start  27: version-2
 27/100 Test  #27: version-2 ..........................................................   Passed    0.01 sec
        Start  28: undefok-1
 28/100 Test  #28: undefok-1 ..........................................................   Passed    0.01 sec
        Start  29: undefok-2
 29/100 Test  #29: undefok-2 ..........................................................   Passed    0.01 sec
        Start  30: undefok-3
 30/100 Test  #30: undefok-3 ..........................................................   Passed    0.01 sec
        Start  31: undefok-4
 31/100 Test  #31: undefok-4 ..........................................................   Passed    0.01 sec
        Start  32: undefok-5
 32/100 Test  #32: undefok-5 ..........................................................   Passed    0.01 sec
        Start  33: undefok-6
 33/100 Test  #33: undefok-6 ..........................................................   Passed    0.01 sec
        Start  34: flagfile.1
 34/100 Test  #34: flagfile.1 .........................................................   Passed    0.01 sec
        Start  35: flagfile.2
 35/100 Test  #35: flagfile.2 .........................................................   Passed    0.01 sec
        Start  36: flagfile.3
 36/100 Test  #36: flagfile.3 .........................................................   Passed    0.01 sec
        Start  37: fromenv=version
 37/100 Test  #37: fromenv=version ....................................................   Passed    0.01 sec
        Start  38: tryfromenv=version
 38/100 Test  #38: tryfromenv=version .................................................   Passed    0.01 sec
        Start  39: fromenv=help
 39/100 Test  #39: fromenv=help .......................................................   Passed    0.01 sec
        Start  40: tryfromenv=help
 40/100 Test  #40: tryfromenv=help ....................................................   Passed    0.01 sec
        Start  41: fromenv=helpfull
 41/100 Test  #41: fromenv=helpfull ...................................................   Passed    0.01 sec
        Start  42: tryfromenv=helpfull
 42/100 Test  #42: tryfromenv=helpfull ................................................   Passed    0.01 sec
        Start  43: tryfromenv=undefok
 43/100 Test  #43: tryfromenv=undefok .................................................   Passed    0.01 sec
        Start  44: tryfromenv=weirdo
 44/100 Test  #44: tryfromenv=weirdo ..................................................   Passed    0.01 sec
        Start  45: tryfromenv-multiple
 45/100 Test  #45: tryfromenv-multiple ................................................   Passed    0.01 sec
        Start  46: fromenv=test_bool
 46/100 Test  #46: fromenv=test_bool ..................................................   Passed    0.01 sec
        Start  47: fromenv=test_bool-ok
 47/100 Test  #47: fromenv=test_bool-ok ...............................................   Passed    0.01 sec
        Start  48: version-overrides-fromenv
 48/100 Test  #48: version-overrides-fromenv ..........................................   Passed    0.01 sec
        Start  49: dashdash
 49/100 Test  #49: dashdash ...........................................................   Passed    0.01 sec
        Start  50: always_fail
 50/100 Test  #50: always_fail ........................................................   Passed    0.01 sec
        Start  51: gflags_declare
 51/100 Test  #51: gflags_declare .....................................................   Passed    0.00 sec
        Start  52: BackendIntegTest.TestOTFProtocolAndHandler
 52/100 Test  #52: BackendIntegTest.TestOTFProtocolAndHandler .........................   Passed    0.57 sec
        Start  53: OTFMessageTest.TestRetieveCmd
 53/100 Test  #53: OTFMessageTest.TestRetieveCmd ......................................   Passed    0.46 sec
        Start  54: OTFMessageTest.TestEncodeLoadModelResponse
 54/100 Test  #54: OTFMessageTest.TestEncodeLoadModelResponse .........................   Passed    0.45 sec
        Start  55: OTFMessageTest.TestUTF8EncodeLoadModelResponse
 55/100 Test  #55: OTFMessageTest.TestUTF8EncodeLoadModelResponse .....................   Passed    0.46 sec
        Start  56: OTFMessageTest.TestRetrieveMsgLoadGpu
 56/100 Test  #56: OTFMessageTest.TestRetrieveMsgLoadGpu ..............................   Passed    0.47 sec
        Start  57: OTFMessageTest.TestRetrieveMsgLoadNoGpu
 57/100 Test  #57: OTFMessageTest.TestRetrieveMsgLoadNoGpu ............................   Passed    0.47 sec
        Start  58: OTFMessageTest.TestEncodeSuccessInferenceResponse
 58/100 Test  #58: OTFMessageTest.TestEncodeSuccessInferenceResponse ..................   Passed    0.46 sec
        Start  59: OTFMessageTest.TestEncodeFailureInferenceResponse
 59/100 Test  #59: OTFMessageTest.TestEncodeFailureInferenceResponse ..................   Passed    0.46 sec
        Start  60: OTFMessageTest.TestRetrieveInferenceMsg
 60/100 Test  #60: OTFMessageTest.TestRetrieveInferenceMsg ............................   Passed    0.46 sec
        Start  61: ModelPredictTest.TestLoadPredictBabyLlamaHandler
 61/100 Test  #61: ModelPredictTest.TestLoadPredictBabyLlamaHandler ...................   Passed    1.98 sec
        Start  62: ModelPredictTest.TestLoadPredictAotInductorLlamaHandler
 62/100 Test  #62: ModelPredictTest.TestLoadPredictAotInductorLlamaHandler ............   Passed    3.39 sec
        Start  63: ModelPredictTest.TestLoadPredictLlamaCppHandler
 63/100 Test  #63: ModelPredictTest.TestLoadPredictLlamaCppHandler ....................***Skipped   0.46 sec
        Start  64: ModelPredictTest.TestLoadPredictAotInductorBertHandler
 64/100 Test  #64: ModelPredictTest.TestLoadPredictAotInductorBertHandler .............   Passed    0.93 sec
        Start  65: ModelPredictTest.TestLoadPredictAotInductorResnetHandler
 65/100 Test  #65: ModelPredictTest.TestLoadPredictAotInductorResnetHandler ...........   Passed    1.05 sec
        Start  66: ModelPredictTest.TestLoadPredictBaseHandler
 66/100 Test  #66: ModelPredictTest.TestLoadPredictBaseHandler ........................   Passed    0.56 sec
        Start  67: ModelPredictTest.TestLoadPredictMnistHandler
 67/100 Test  #67: ModelPredictTest.TestLoadPredictMnistHandler .......................   Passed    0.55 sec
        Start  68: ModelPredictTest.TestBackendInitWrongModelDir
 68/100 Test  #68: ModelPredictTest.TestBackendInitWrongModelDir ......................   Passed    0.46 sec
        Start  69: ModelPredictTest.TestBackendInitWrongHandler
 69/100 Test  #69: ModelPredictTest.TestBackendInitWrongHandler .......................   Passed    0.46 sec
        Start  70: ModelPredictTest.TestLoadModelFailure
 70/100 Test  #70: ModelPredictTest.TestLoadModelFailure ..............................   Passed    0.47 sec
        Start  71: ModelPredictTest.TestLoadPredictMnistHandlerFailure
 71/100 Test  #71: ModelPredictTest.TestLoadPredictMnistHandlerFailure ................   Passed    0.50 sec
        Start  72: DLLoaderTest.TestGetInstance
 72/100 Test  #72: DLLoaderTest.TestGetInstance .......................................   Passed    0.46 sec
        Start  73: JsonTest.TestParsingAndGetValue
 73/100 Test  #73: JsonTest.TestParsingAndGetValue ....................................   Passed    0.46 sec
        Start  74: LoggingTest.TestIncorrectLogInitialization
 74/100 Test  #74: LoggingTest.TestIncorrectLogInitialization .........................   Passed    0.47 sec
        Start  75: LoggingTest.TestFileLogInitialization
 75/100 Test  #75: LoggingTest.TestFileLogInitialization ..............................   Passed    0.46 sec
        Start  76: TSLogMetricTest.TestCounterMetric
 76/100 Test  #76: TSLogMetricTest.TestCounterMetric ..................................   Passed    0.47 sec
        Start  77: TSLogMetricTest.TestGaugeMetric
 77/100 Test  #77: TSLogMetricTest.TestGaugeMetric ....................................   Passed    0.47 sec
        Start  78: TSLogMetricTest.TestHistogramMetric
 78/100 Test  #78: TSLogMetricTest.TestHistogramMetric ................................   Passed    0.46 sec
        Start  79: TSLogMetricTest.TestTSLogMetricEmitWithRequestId
 79/100 Test  #79: TSLogMetricTest.TestTSLogMetricEmitWithRequestId ...................   Passed    0.46 sec
        Start  80: TSLogMetricTest.TestTSLogMetricEmitWithoutRequestId
 80/100 Test  #80: TSLogMetricTest.TestTSLogMetricEmitWithoutRequestId ................   Passed    0.46 sec
        Start  81: TSLogMetricTest.TestTSLogMetricEmitWithIncorrectDimensionData
 81/100 Test  #81: TSLogMetricTest.TestTSLogMetricEmitWithIncorrectDimensionData ......   Passed    0.46 sec
        Start  82: TSLogMetricsCacheTest.TestInitialize
 82/100 Test  #82: TSLogMetricsCacheTest.TestInitialize ...............................   Passed    0.46 sec
        Start  83: TSLogMetricsCacheTest.TestGetMetric
 83/100 Test  #83: TSLogMetricsCacheTest.TestGetMetric ................................   Passed    0.46 sec
        Start  84: RegistryTest.TestValidConfigFile
 84/100 Test  #84: RegistryTest.TestValidConfigFile ...................................   Passed    0.46 sec
        Start  85: RegistryTest.TestInvalidConfigFile
 85/100 Test  #85: RegistryTest.TestInvalidConfigFile .................................   Passed    0.47 sec
        Start  86: RegistryTest.TestReInitialize
 86/100 Test  #86: RegistryTest.TestReInitialize ......................................   Passed    0.47 sec
        Start  87: UnitsTest.TestGetExistingUnitMapping
 87/100 Test  #87: UnitsTest.TestGetExistingUnitMapping ...............................   Passed    0.46 sec
        Start  88: UnitsTest.TestGetNonExistentUnitMapping
 88/100 Test  #88: UnitsTest.TestGetNonExistentUnitMapping ............................   Passed    0.46 sec
        Start  89: UnitsTest.TestGetEmptyUnitMapping
 89/100 Test  #89: UnitsTest.TestGetEmptyUnitMapping ..................................   Passed    0.45 sec
46 sec
        Start  94: YAMLConfigTest.TestLoadInvalidConfigWithEmptyDimension
 94/100 Test  #94: YAMLConfigTest.TestLoadInvalidConfigWithEmptyDimension .............   Passed    0.46 sec
        Start  95: YAMLConfigTest.TestLoadInvalidConfigWithUndefinedDimension
 95/100 Test  #95: YAMLConfigTest.TestLoadInvalidConfigWithUndefinedDimension .........   Passed    0.46 sec
        Start  96: YAMLConfigTest.TestLoadInvalidConfigWithDuplicateMetricDimension
 96/100 Test  #96: YAMLConfigTest.TestLoadInvalidConfigWithDuplicateMetricDimension ...   Passed    0.47 sec
        Start  97: YAMLConfigTest.TestLoadInvalidConfigWithMissingMetricName
 97/100 Test  #97: YAMLConfigTest.TestLoadInvalidConfigWithMissingMetricName ..........   Passed    0.46 sec
        Start  98: YAMLConfigTest.TestLoadInvalidConfigWithEmptyMetricName
 98/100 Test  #98: YAMLConfigTest.TestLoadInvalidConfigWithEmptyMetricName ............   Passed    0.46 sec
        Start  99: YAMLConfigTest.TestLoadInvalidConfigWithDuplicateMetricName
 99/100 Test  #99: YAMLConfigTest.TestLoadInvalidConfigWithDuplicateMetricName ........   Passed    0.46 sec
        Start 100: ManifestTest.TestInitialize
100/100 Test #100: ManifestTest.TestInitialize ........................................   Passed    0.46 sec

100% tests passed, 0 tests failed out of 100

Total Test time (real) =  28.85 sec

The following tests did not run:
         63 - ModelPredictTest.TestLoadPredictLlamaCppHandler (Skipped)
ubuntu@ip-172-31-8-32:~/serve/cpp/build$ cd ..
ubuntu@ip-172-31-8-32:~/serve/cpp$ git status
On branch feature/install_in_cmake
Your branch is up to date with 'origin/feature/install_in_cmake'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   src/examples/CMakeLists.txt
        modified:   test/CMakeLists.txt
        modified:   test/backends/otf_protocol_and_handler_test.cc
        modified:   test/utils/common.hh

no changes added to commit (use "git add" and/or "git commit -a")
ubuntu@ip-172-31-8-32:~/serve/cpp$
        Start  90: YAMLConfigTest.TestLoadValidConfigFrontendContext
d   0.45 sec
 93/100 Test  #93: YAMLConfigTest.TestLoadInvalidConfigWithDuplicateDimension .........   Passed    0. 6 sec  Start  94: YAMLConfigTest.TestLoadInvalidConfigWithEmptyDimension
 94/100 Test  #94: YAMLConfigTest.TestLoadInvalidConfigWithEmptyDimension .............   Passed    0. 6 sec  Start  95: YAMLConfigTest.TestLoadInvalidConfigWithUndefinedDimension
 95/100 Test  #95: YAMLConfigTest.TestLoadInvalidConfigWithUndefinedDimension .........   Passed    0. 6 sec  Start  96: YAMLConfigTest.TestLoadInvalidConfigWithDuplicateMetricDimension
 96/100 Test  #96: YAMLConfigTest.TestLoadInvalidConfigWithDuplicateMetricDimension ...   Passed    0. 7 sec  Start  97: YAMLConfigTest.TestLoadInvalidConfigWithMissingMetricName
 97/100 Test  #97: YAMLConfigTest.TestLoadInvalidConfigWithMissingMetricName ..........   Passed    0. 6 sec  Start  98: YAMLConfigTest.TestLoadInvalidConfigWithEmptyMetricName
 98/100 Test  #98: YAMLConfigTest.TestLoadInvalidConfigWithEmptyMetricName ............   Passed    0. 6 sec  Start  99: YAMLConfigTest.TestLoadInvalidConfigWithDuplicateMetricName
 99/100 Test  #99: YAMLConfigTest.TestLoadInvalidConfigWithDuplicateMetricName ........   Passed    0.46 sec  Start 100: ManifestTest.TestInitialize
100/100 Test #100: ManifestTest.TestInitialize ........................................   Passed    0.46 sec

100% tests passed, 0 tests failed out of 100

Total Test time (real) =  28.85 sec

The following tests did not run:
         63 - ModelPredictTest.TestLoadPredictLlamaCppHandler (Skipped)
ubuntu@ip-172-31-8-32:~/serve/cpp/build$ cd ..
ubuntu@ip-172-31-8-32:~/serve/cpp$ git status
On branch feature/install_in_cmake
Your branch is up to date with 'origin/feature/install_in_cmake'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   src/examples/CMakeLists.txt
        modified:   test/CMakeLists.txt
        modified:   test/backends/otf_protocol_and_handler_test.cc
        modified:   test/utils/common.hh

no changes added to commit (use "git add" and/or "git commit -a")
ubuntu@ip-172-31-8-32:~/serve/cpp$
.   Passed    0.46 sec
        Start  94: YAMLConfigTest.TestLoadInvalidConfigWithEmptyDimension
 94/100 Test  #94: YAMLConfigTest.TestLoadInvalidConfigWithEmptyDimension .............   Passed    0.46 sec
        Start  95: YAMLConfigTest.TestLoadInvalidConfigWithUndefinedDimension
 95/100 Test  #95: YAMLConfigTest.TestLoadInvalidConfigWithUndefinedDimension .........   Passed    0.46 sec
        Start  96: YAMLConfigTest.TestLoadInvalidConfigWithDuplicateMetricDimension
 96/100 Test  #96: YAMLConfigTest.TestLoadInvalidConfigWithDuplicateMetricDimension ...   Passed    0.47 sec
         Start  97: YAMLConfigTest.TestLoadInvalidConfigWithMissingMetricName
 97/100 Test  #97: YAMLConfigTest.TestLoadInvalidConfigWithMissingMetricName ..........   Passed    0.46 sec
         Start  98: YAMLConfigTest.TestLoadInvalidConfigWithEmptyMetricName
 98/100 Test  #98: YAMLConfigTest.TestLoadInvalidConfigWithEmptyMetricName ............   Passed    0.46 sec
         Start  99: YAMLConfigTest.TestLoadInvalidConfigWithDuplicateMetricName
 99/100 Test  #99: YAMLConfigTest.TestLoadInvalidConfigWithDuplicateMetricName ........   Passed    0.46 sec
         Start 100: ManifestTest.TestInitialize
100/100 Test #100: ManifestTest.TestInitialize ........................................   Passed    0.46 sec

100% tests passed, 0 tests failed out of 100

Total Test time (real) =  28.85 sec

The following tests did not run:
         63 - ModelPredictTest.TestLoadPredictLlamaCppHandler (Skipped)
ubuntu@ip-172-31-8-32:~/serve/cpp/build$ cd ..
ubuntu@ip-172-31-8-32:~/serve/cpp$ git status
On branch feature/install_in_cmake
Your branch is up to date with 'origin/feature/install_in_cmake'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   src/examples/CMakeLists.txt
        modified:   test/CMakeLists.txt
        modified:   test/backends/otf_protocol_and_handler_test.cc
        modified:   test/utils/common.hh

no changes added to commit (use "git add" and/or "git commit -a")
ubuntu@ip-172-31-8-32:~/serve/cpp$
..   Passed    0.46 sec
        Start  94: YAMLConfigTest.TestLoadInvalidConfigWithEmptyDimension
 94/100 Test  #94: YAMLConfigTest.TestLoadInvalidConfigWithEmptyDimension .............   Passed    0.46 sec
        Start  95: YAMLConfigTest.TestLoadInvalidConfigWithUndefinedDimension
 95/100 Test  #95: YAMLConfigTest.TestLoadInvalidConfigWithUndefinedDimension .........   Passed    0.46 sec
        Start  96: YAMLConfigTest.TestLoadInvalidConfigWithDuplicateMetricDimension
 96/100 Test  #96: YAMLConfigTest.TestLoadInvalidConfigWithDuplicateMetricDimension ...   Passed    0.47 sec
        Start  97: YAMLConfigTest.TestLoadInvalidConfigWithMissingMetricName
 97/100 Test  #97: YAMLConfigTest.TestLoadInvalidConfigWithMissingMetricName ..........   Passed    0.46 sec
        Start  98: YAMLConfigTest.TestLoadInvalidConfigWithEmptyMetricName
 98/100 Test  #98: YAMLConfigTest.TestLoadInvalidConfigWithEmptyMetricName ............   Passed    0.46 sec
        Start  99: YAMLConfigTest.TestLoadInvalidConfigWithDuplicateMetricName
 99/100 Test  #99: YAMLConfigTest.TestLoadInvalidConfigWithDuplicateMetricName ........   Passed    0.46 sec
        Start 100: ManifestTest.TestInitialize
100/100 Test #100: ManifestTest.TestInitialize ........................................   Passed    0.46 sec

100% tests passed, 0 tests failed out of 100

Total Test time (real) =  28.85 sec

The following tests did not run:
         63 - ModelPredictTest.TestLoadPredictLlamaCppHandler (Skipped)

Checklist:

  • Did you have fun?
  • Have you added tests that prove your fix is effective or that this feature works?

@mreso mreso requested review from lxning and chauhang March 13, 2024 04:15
@mreso mreso changed the title Install binaries using cmake + fix cpp ci Install binaries using cmake Mar 13, 2024
@mreso mreso changed the title Install binaries using cmake CPP build in pure cmake Mar 14, 2024
@lxning lxning added the c++ label Mar 20, 2024
@lxning lxning added this to the v0.10.1 milestone Mar 20, 2024
@chauhang
Copy link
Contributor

@lxning @mreso What is the work remaining for this PR?

@lxning
Copy link
Collaborator

lxning commented Apr 15, 2024

@lxning @mreso What is the work remaining for this PR?

No further work is needed.

@lxning lxning added this pull request to the merge queue Apr 16, 2024
Merged via the queue into master with commit d654750 Apr 16, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants