-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Extend simple lib example to support GPU inputs / outputs #579
Conversation
src/servers/simple.cc
Outdated
*buffer = (byte_size == 0) ? nullptr : malloc(byte_size); | ||
// need to do any other book-keeping. | ||
if (byte_size == 0) { | ||
*buffer = nullptr; | ||
*buffer_userp = new std::string(tensor_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*buffer_userp = nullptr when byte_size is 0. Release won't be called (will it?) and buffer_userp is just passed to release.
src/servers/simple.cc
Outdated
@@ -24,6 +24,7 @@ | |||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
|
|||
#include <cuda_runtime_api.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need some ifdef GPU
src/servers/simple.cc
Outdated
LOG_INFO << "Releasing buffer " << buffer << " of size " << byte_size | ||
<< " for result '" << *name << "'"; | ||
free(buffer); | ||
std::string memory_type_str = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this global and use it in the logging in the alloc function as well.
src/servers/simple.cc
Outdated
@@ -48,6 +69,7 @@ Usage(char** argv, const std::string& msg = std::string()) | |||
} | |||
|
|||
LOG_ERROR << "Usage: " << argv[0] << " [options]"; | |||
LOG_ERROR << "\t-g store input data in GPU"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Use GPU memory for input and output tensors"
src/servers/simple.cc
Outdated
void* allocated_ptr = nullptr; | ||
if (memory_type == TRTSERVER_MEMORY_CPU) { | ||
allocated_ptr = malloc(byte_size); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only use GPU if -g flag was specified
src/servers/simple.cc
Outdated
@@ -118,11 +167,15 @@ int | |||
main(int argc, char** argv) | |||
{ | |||
std::string model_repository_path; | |||
bool gpu_input = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gpu_input implies only using for input. How about "use_gpu_memory"
No description provided.