This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 1475 - Issue with static global variables in TensorDeviceCuda
Summary: Issue with static global variables in TensorDeviceCuda
Status: NEW
Alias: None
Product: Eigen
Classification: Unclassified
Component: Tensor (show other bugs)
Version: 3.4 (development)
Hardware: All All
: Normal Unknown
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-12 08:23 UTC by Gael Guennebaud
Modified: 2019-12-04 17:13 UTC (History)
4 users (show)



Attachments

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.

Note You need to log in before you can comment on or make changes to this bug.