1 /* Copyright 2021 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 #ifndef TENSORFLOW_C_EXPERIMENTAL_STREAM_EXECUTOR_STREAM_EXECUTOR_TEST_UTIL_H_ 16 #define TENSORFLOW_C_EXPERIMENTAL_STREAM_EXECUTOR_STREAM_EXECUTOR_TEST_UTIL_H_ 17 18 #include "tensorflow/c/experimental/stream_executor/stream_executor.h" 19 20 struct SP_Stream_st { SP_Stream_stSP_Stream_st21 explicit SP_Stream_st(int id) : stream_id(id) {} 22 int stream_id; 23 }; 24 25 struct SP_Event_st { SP_Event_stSP_Event_st26 explicit SP_Event_st(int id) : event_id(id) {} 27 int event_id; 28 }; 29 30 struct SP_Timer_st { SP_Timer_stSP_Timer_st31 explicit SP_Timer_st(int id) : timer_id(id) {} 32 int timer_id; 33 }; 34 35 namespace stream_executor { 36 namespace test_util { 37 38 constexpr int kDeviceCount = 2; 39 constexpr char kDeviceName[] = "MY_DEVICE"; 40 constexpr char kDeviceType[] = "GPU"; 41 42 void PopulateDefaultStreamExecutor(SP_StreamExecutor* se); 43 void PopulateDefaultDeviceFns(SP_DeviceFns* device_fns); 44 void PopulateDefaultTimerFns(SP_TimerFns* timer_fns); 45 void PopulateDefaultPlatform(SP_Platform* platform, 46 SP_PlatformFns* platform_fns); 47 void PopulateDefaultPlatformRegistrationParams( 48 SE_PlatformRegistrationParams* const params); 49 50 void DestroyPlatform(SP_Platform* platform); 51 void DestroyPlatformFns(SP_PlatformFns* platform_fns); 52 53 } // namespace test_util 54 } // namespace stream_executor 55 56 #endif // TENSORFLOW_C_EXPERIMENTAL_STREAM_EXECUTOR_STREAM_EXECUTOR_TEST_UTIL_H_ 57