This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen

Bug 1475

Summary: Issue with static global variables in TensorDeviceCuda
Product: Eigen Reporter: Gael Guennebaud <gael.guennebaud>
Component: TensorAssignee: Nobody <eigen.nobody>
Status: NEW ---    
Severity: Unknown CC: benoit.steiner.goog, chtz, gael.guennebaud, rmlarsen
Priority: Normal    
Version: 3.4 (development)   
Hardware: All   
OS: All   
Whiteboard:

Description Gael Guennebaud 2017-10-12 08:23:31 UTC
Reported by Sun Chenggen:

**********
 I found a bug in TensorDeviceCuda.h
       In line 40~41 m_deviceProperties and m_devicePropInitialized are defined as global static variable, which would generate different copies in different translation unit, if you call initializeDeviceProp() in one translation unit and use GpuDevice in another, you will find m_deviceProperties  is still zero.
I think the two variables should be inline instead of static, may be implement like below:
 
inline cudaDeviceProp*& getDeviceProerties(){
   static cudaDeviceProp*  deviceProperties;
    return deviceProperties;
}
inline bool& getDevicePropInitialized(){
    static bool devicePropInitialized = false;
    return devicePropInitialized;
}
**********
Comment 1 Nobody 2019-12-04 17:13:34 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1475.