Merge pull request #640 from reyoung/feature/add_proto3

Add syntax='proto2' when using protobuf 3
avx_docs
gangliao 9 years ago committed by GitHub
commit a328da4673

@ -1,3 +1,12 @@
execute_process(COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} --version
OUTPUT_VARIABLE PROTOBUF_VERSION)
string(REPLACE "libprotoc " "" PROTOBUF_VERSION ${PROTOBUF_VERSION})
set(PROTOBUF_3 OFF)
if (${PROTOBUF_VERSION} VERSION_GREATER "3.0.0" OR ${PROTOBUF_VERSION} VERSION_EQUAL "3.0.0")
set(PROTOBUF_3 ON)
endif()
set(proto_filenames set(proto_filenames
DataConfig.proto DataConfig.proto
DataFormat.proto DataFormat.proto
@ -11,8 +20,12 @@ set(real_proto_files)
# TODO(yuyang18): Some internal proto will also be depended on. # TODO(yuyang18): Some internal proto will also be depended on.
# Find a way to automatically calculate all depends. # Find a way to automatically calculate all depends.
foreach(filename ${proto_filenames}) foreach(filename ${proto_filenames})
set(PROTOBUF_3_FLAGS "")
if (PROTOBUF_3)
set(PROTOBUF_3_FLAGS "-Dproto3")
endif()
add_custom_command(OUTPUT ${filename} add_custom_command(OUTPUT ${filename}
COMMAND ${M4_EXECUTABLE} -Dreal=${ACCURACY} -I '${INTERNAL_PROTO_PATH}' COMMAND ${M4_EXECUTABLE} -Dreal=${ACCURACY} ${PROTOBUF_3_FLAGS} -I '${INTERNAL_PROTO_PATH}'
${PROJ_ROOT}/proto/${filename}.m4 > ${filename} ${PROJ_ROOT}/proto/${filename}.m4 > ${filename}
DEPENDS ${PROJ_ROOT}/proto/${filename}.m4 DEPENDS ${PROJ_ROOT}/proto/${filename}.m4
COMMENT "Generate ${filename}") COMMENT "Generate ${filename}")

@ -11,6 +11,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
ifdef(`proto3', `syntax = "proto2";')
package paddle; package paddle;

@ -11,6 +11,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
ifdef(`proto3', `syntax = "proto2";')
package paddle; package paddle;

@ -11,6 +11,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
ifdef(`proto3', `syntax = "proto2";')
import "ParameterConfig.proto"; import "ParameterConfig.proto";

@ -11,6 +11,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
ifdef(`proto3', `syntax = "proto2";')
package paddle; package paddle;

@ -11,6 +11,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
ifdef(`proto3', `syntax = "proto2";')
import "ParameterConfig.proto"; import "ParameterConfig.proto";
import "TrainerConfig.proto"; import "TrainerConfig.proto";
@ -20,7 +21,6 @@ package paddle;
/** /**
* Various structs for communicating with parameter server * Various structs for communicating with parameter server
*/ */
enum ParameterUpdateMode { enum ParameterUpdateMode {
// Set parameter // Set parameter
PSERVER_UPDATE_MODE_SET_PARAM = 0;//use local param PSERVER_UPDATE_MODE_SET_PARAM = 0;//use local param

@ -11,6 +11,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
ifdef(`proto3', `syntax = "proto2";')
import "DataConfig.proto"; import "DataConfig.proto";
import "ModelConfig.proto"; import "ModelConfig.proto";

Loading…
Cancel
Save