MSI Afterburner .NET Class Library

Discussion in 'MSI AfterBurner Application Development Forum' started by stangowner, Feb 28, 2011.

  1. stangowner

    stangowner Guest

    Messages:
    607
    Likes Received:
    11
    GPU:
    2xMSI N550GTX-Ti Cy II OC
    Unwinder, can you assist on this one? I don't think changing it on the MACM_SHARED_MEMORY_GPU_ENTRY is a good idea, as this is flags showing the capabilities of the card and the user should not have access to the other flags. However, I could create a helper method on that class. But I would think it could be set in MACM_SHARED_MEMORY_HEADER. However, I'm unable to set it. Is this flag read only? Meaning when I send the flush command, is this not being considered for changes? Is it currently possible for me to control the syncing/linking?
     
  2. stangowner

    stangowner Guest

    Messages:
    607
    Likes Received:
    11
    GPU:
    2xMSI N550GTX-Ti Cy II OC
    Indeed, I'm quite behind on updating this to match additions in Afterburner. I'll take a look and update as required.
     
  3. Unwinder

    Unwinder Ancient Guru Staff Member

    Messages:
    17,197
    Likes Received:
    6,865
    Check MACMSharedMemorySample, AFAIR it was able to alter "Sync similar GPUs" setting from external application somehow.
     
  4. stangowner

    stangowner Guest

    Messages:
    607
    Likes Received:
    11
    GPU:
    2xMSI N550GTX-Ti Cy II OC
    I can't reproduce. Here is my GPU0 (GTX 550 Ti):
    Code:
    ? macm.GpuEntries[0]
    {IsMaster = True;Flags = CORE_CLOCK, SHADER_CLOCK, MEMORY_CLOCK, FAN_SPEED, SYNCHRONIZED_WITH_MASTER;FanFlagsCur = AUTO;FanFlagsDev = AUTO;FanSpeed = Cur:40, Min:40, Max:100, Def:0;CoreClock = Cur:950010, Min:475000, Max:1425000, Def:950000;ShaderClock = Cur:1900020, Min:950000, Max:2850000, Def:1900000;MemoryClock = Cur:2150000, Min:1075000, Max:2795000, Def:2150000;CoreVoltage = Cur:0, Min:0, Max:0, Def:0;MemoryVoltage = Cur:0, Min:0, Max:0, Def:0;AuxVoltage = Cur:0, Min:0, Max:0, Def:0;CoreVoltageBoost = Cur:0, Min:0, Max:0, Def:0;MemoryVoltageBoost = Cur:0, Min:0, Max:0, Def:0;AuxVoltageBoost = Cur:0, Min:0, Max:0, Def:0;PowerLimit = Cur:0, Min:0, Max:0, Def:0;CoreClockBoost = Cur:0, Min:0, Max:0, Def:0;MemoryClockBoost = Cur:0, Min:0, Max:0, Def:0}
        AuxVoltageBoostCur: 0
        AuxVoltageBoostDef: 0
        AuxVoltageBoostMax: 0
        AuxVoltageBoostMin: 0
        AuxVoltageCur: 0
        AuxVoltageDef: 0
        AuxVoltageMax: 0
        AuxVoltageMin: 0
        CoreClockBoostCur: 0
        CoreClockBoostDef: 0
        CoreClockBoostMax: 0
        CoreClockBoostMin: 0
        CoreClockCur: 950010
        CoreClockDef: 950000
        CoreClockMax: 1425000
        CoreClockMin: 475000
        CoreVoltageBoostCur: 0
        CoreVoltageBoostDef: 0
        CoreVoltageBoostMax: 0
        CoreVoltageBoostMin: 0
        CoreVoltageCur: 0
        CoreVoltageDef: 0
        CoreVoltageMax: 0
        CoreVoltageMin: 0
        FanFlagsCur: AUTO
        FanFlagsDef: AUTO
        FanSpeedCur: 40
        FanSpeedDef: 0
        FanSpeedMax: 100
        FanSpeedMin: 40
        Flags: CORE_CLOCK | SHADER_CLOCK | MEMORY_CLOCK | FAN_SPEED | SYNCHRONIZED_WITH_MASTER
        Index: 0
        IsMaster: true
        MemoryClockBoostCur: 0
        MemoryClockBoostDef: 0
        MemoryClockBoostMax: 0
        MemoryClockBoostMin: 0
        MemoryClockCur: 2150000
        MemoryClockDef: 2150000
        MemoryClockMax: 2795000
        MemoryClockMin: 1075000
        MemoryVoltageBoostCur: 0
        MemoryVoltageBoostDef: 0
        MemoryVoltageBoostMax: 0
        MemoryVoltageBoostMin: 0
        MemoryVoltageCur: 0
        MemoryVoltageDef: 0
        MemoryVoltageMax: 0
        MemoryVoltageMin: 0
        PowerLimitCur: 0
        PowerLimitDef: 0
        PowerLimitMax: 0
        PowerLimitMin: 0
        ShaderClockCur: 1900020
        ShaderClockDef: 1900000
        ShaderClockMax: 2850000
        ShaderClockMin: 950000
        ThermalLimitCur: 0
        ThermalLimitDef: 0
        ThermalLimitMax: 0
        ThermalLimitMin: 0
        index: 0
        isMaster: true
        macmGpuEntry: {MSI.Afterburner.MACM_SHARED_MEMORY_GPU_ENTRY}
    
    I'll try to dig in a bit further to see if I can find anything.
     

  5. Unwinder

    Unwinder Ancient Guru Staff Member

    Messages:
    17,197
    Likes Received:
    6,865
    Nothing is wrong on his system, it is understanding issue. He is using Pascal GPU, core clock is not static and cannot be controlled directly with a single clock value. And that's reflected in flags, CORE_CLOCK is not set. Core clock is controlled in offset form so CORE_CLOCK_BOOST is set instead.
     
  6. stangowner

    stangowner Guest

    Messages:
    607
    Likes Received:
    11
    GPU:
    2xMSI N550GTX-Ti Cy II OC
    As usual, I think you are correct. And yes, looks like you have that in the demo. I think my issue was I am setting it in the .NET class, but in my shared memory helper I am doing selective updates (flush & init only) and not pushing other properties of the object back. I'll give it a shot, but should be able to get this going. Thanks again!
     
  7. stangowner

    stangowner Guest

    Messages:
    607
    Likes Received:
    11
    GPU:
    2xMSI N550GTX-Ti Cy II OC
    Makes perfect sense! Thank you for saving me some running around!
     
  8. moonter45

    moonter45 Guest

    Messages:
    1
    Likes Received:
    0
    GPU:
    1060
    hello stangowner, its possible to load previously saved profile in Afterburner ?
     
  9. stangowner

    stangowner Guest

    Messages:
    607
    Likes Received:
    11
    GPU:
    2xMSI N550GTX-Ti Cy II OC
    No, I don't believe this can be done. You'd have to save and reload profiles made with this library, not the ones in afterburner itself. See the control memory example.
     
    moonter45 likes this.
  10. makar

    makar Guest

    Messages:
    3
    Likes Received:
    0
    GPU:
    GTX 960m
    Hi stangowner
    Im using your librarry for read properies and wrote my own for commit, and everything is working.
    ControlMemoryHeader.Flags and ControlMemoryHeader.MasterGpu are not read only for MSIAfterBurner.

    If ControlMemoryHeader.Flags & MACM_SHARED_MEMORY_FLAG.SYNC then all settings from master gpu will be aplied for simmilar GPUs else every gpu has own settings, defined in GpuEntry.
     

  11. stangowner

    stangowner Guest

    Messages:
    607
    Likes Received:
    11
    GPU:
    2xMSI N550GTX-Ti Cy II OC
    Yes, noted. I'm in the process of making several updates, including this one. I should have a new version soon.
     
    moonter45 likes this.
  12. makar

    makar Guest

    Messages:
    3
    Likes Received:
    0
    GPU:
    GTX 960m
    thank you
     
  13. 4ward

    4ward Guest

    Messages:
    1
    Likes Received:
    0
    GPU:
    Radeon RX 480 8GB
    @stangowner

    Strange behavior with v1.1.1 dll
    When creating a new object or using ReloadAll() method on the HardwareMonitor class, it dumps all the values to screen, and it cant be piped or hidden...

    sample code:
    Code:
    Add-Type -Path .\MSIAfterburner.NET.dll
    $abMonitor = New-Object MSI.Afterburner.HardwareMonitor
    $abMonitor.ReloadAll()
    sample output:
    Code:
    SrcName = GPU1 temperature;SrcUnits = °C;LocalizedSourceName = GPU1 temperature;LocalizedSrcUnits = °C;RecommendedFormat = %.0f;Data = 46;MinLimit = 0;MaxLimit = 100;Flags = None;GPU = 0;SrcId = 0
    SrcName = GPU1 usage;SrcUnits = %;LocalizedSourceName = GPU1 usage;LocalizedSrcUnits = %;RecommendedFormat = %.0f;Data = 100;MinLimit = 0;MaxLimit = 100;Flags = None;GPU = 0;SrcId = 48
    SrcName = GPU2 usage;SrcUnits = %;LocalizedSourceName = GPU2 usage;LocalizedSrcUnits = %;RecommendedFormat = %.0f;Data = 0;MinLimit = 0;MaxLimit = 100;Flags = None;GPU = 1;SrcId = 48
    SrcName = GPU1 FB usage;SrcUnits = %;LocalizedSourceName = GPU1 FB usage;LocalizedSrcUnits = %;RecommendedFormat = %.0f;Data = 6;MinLimit = 0;MaxLimit = 100;Flags = None;GPU = 0;SrcId = 50
    SrcName = GPU2 VID usage;SrcUnits = %;LocalizedSourceName = GPU2 VID usage;LocalizedSrcUnits = %;RecommendedFormat = %.0f;Data = 0;MinLimit = 0;MaxLimit = 100;Flags = None;GPU = 1;SrcId = 51
    SrcName = GPU1 memory usage;SrcUnits = MB;LocalizedSourceName = GPU1 memory usage;LocalizedSrcUnits = MB;RecommendedFormat = %.0f;Data = 1733.793;MinLimit = 0;MaxLimit = 8192;Flags = None;GPU = 0;SrcId = 49
    SrcName = GPU2 memory usage;SrcUnits = MB;LocalizedSourceName = GPU2 memory usage;LocalizedSrcUnits = MB;RecommendedFormat = %.0f;Data = 1.289063;MinLimit = 0;MaxLimit = 8192;Flags = None;GPU = 1;SrcId = 49
    SrcName = GPU1 core clock;SrcUnits = MHz;LocalizedSourceName = GPU1 core clock;LocalizedSrcUnits = MHz;RecommendedFormat = %.0f;Data = 1266;MinLimit = 0;MaxLimit = 2500;Flags = None;GPU = 0;SrcId = 32
    SrcName = GPU1 memory clock;SrcUnits = MHz;LocalizedSourceName = GPU1 memory clock;LocalizedSrcUnits = MHz;RecommendedFormat = %.0f;Data = 300;MinLimit = 0;MaxLimit = 7500;Flags = None;GPU = 0;SrcId = 34
    SrcName = GPU1 power;SrcUnits = W;LocalizedSourceName = GPU1 power;LocalizedSrcUnits = W;RecommendedFormat = %.1f;Data = 51.523;MinLimit = 0;MaxLimit = 300;Flags = None;GPU = 0;SrcId = 96
    SrcName = GPU1 fan speed;SrcUnits = %;LocalizedSourceName = GPU1 fan speed;LocalizedSrcUnits = %;RecommendedFormat = %.0f;Data = 27;MinLimit = 0;MaxLimit = 100;Flags = None;GPU = 0;SrcId = 16
    SrcName = GPU1 fan tachometer;SrcUnits = RPM;LocalizedSourceName = GPU1 fan tachometer;LocalizedSrcUnits = RPM;RecommendedFormat = %.0f;Data = 1312;MinLimit = 0;MaxLimit = 10000;Flags = None;GPU = 0;SrcId = 17
    SrcName = CPU1 temperature;SrcUnits = °C;LocalizedSourceName = CPU1 temperature;LocalizedSrcUnits = °C;RecommendedFormat = %.0f;Data = 40;MinLimit = 0;MaxLimit = 100;Flags = None;GPU = 0;SrcId = 128
    SrcName = CPU2 temperature;SrcUnits = °C;LocalizedSourceName = CPU2 temperature;LocalizedSrcUnits = °C;RecommendedFormat = %.0f;Data = 40;MinLimit = 0;MaxLimit = 100;Flags = None;GPU = 1;SrcId = 128
    SrcName = CPU3 temperature;SrcUnits = °C;LocalizedSourceName = CPU3 temperature;LocalizedSrcUnits = °C;RecommendedFormat = %.0f;Data = 47;MinLimit = 0;MaxLimit = 100;Flags = None;GPU = 2;SrcId = 128
    SrcName = CPU4 temperature;SrcUnits = °C;LocalizedSourceName = CPU4 temperature;LocalizedSrcUnits = °C;RecommendedFormat = %.0f;Data = 39;MinLimit = 0;MaxLimit = 100;Flags = None;GPU = 3;SrcId = 128
    SrcName = CPU temperature;SrcUnits = °C;LocalizedSourceName = CPU temperature;LocalizedSrcUnits = °C;RecommendedFormat = %.0f;Data = 47;MinLimit = 0;MaxLimit = 100;Flags = None;GPU = 4294967295;SrcId = 128
    SrcName = CPU1 usage;SrcUnits = %;LocalizedSourceName = CPU1 usage;LocalizedSrcUnits = %;RecommendedFormat = %.0f;Data = 6.408631;MinLimit = 0;MaxLimit = 100;Flags = None;GPU = 0;SrcId = 144
    SrcName = CPU2 usage;SrcUnits = %;LocalizedSourceName = CPU2 usage;LocalizedSrcUnits = %;RecommendedFormat = %.0f;Data = 12.75381;MinLimit = 0;MaxLimit = 100;Flags = None;GPU = 1;SrcId = 144
    SrcName = CPU3 usage;SrcUnits = %;LocalizedSourceName = CPU3 usage;LocalizedSrcUnits = %;RecommendedFormat = %.0f;Data = 7.994926;MinLimit = 0;MaxLimit = 100;Flags = None;GPU = 2;SrcId = 144
    SrcName = CPU4 usage;SrcUnits = %;LocalizedSourceName = CPU4 usage;LocalizedSrcUnits = %;RecommendedFormat = %.0f;Data = 6.408631;MinLimit = 0;MaxLimit = 100;Flags = None;GPU = 3;SrcId = 144
    SrcName = CPU usage;SrcUnits = %;LocalizedSourceName = CPU usage;LocalizedSrcUnits = %;RecommendedFormat = %.0f;Data = 8.3915;MinLimit = 0;MaxLimit = 100;Flags = None;GPU = 4294967295;SrcId = 144
    SrcName = CPU1 clock;SrcUnits = MHz;LocalizedSourceName = CPU1 clock;LocalizedSrcUnits = MHz;RecommendedFormat = %.0f;Data = 4490.521;MinLimit = 0;MaxLimit = 5000;Flags = None;GPU = 0;SrcId = 160
    SrcName = CPU2 clock;SrcUnits = MHz;LocalizedSourceName = CPU2 clock;LocalizedSrcUnits = MHz;RecommendedFormat = %.0f;Data = 4490.521;MinLimit = 0;MaxLimit = 5000;Flags = None;GPU = 1;SrcId = 160
    SrcName = CPU3 clock;SrcUnits = MHz;LocalizedSourceName = CPU3 clock;LocalizedSrcUnits = MHz;RecommendedFormat = %.0f;Data = 4490.521;MinLimit = 0;MaxLimit = 5000;Flags = None;GPU = 2;SrcId = 160
    SrcName = CPU4 clock;SrcUnits = MHz;LocalizedSourceName = CPU4 clock;LocalizedSrcUnits = MHz;RecommendedFormat = %.0f;Data = 4490.521;MinLimit = 0;MaxLimit = 5000;Flags = None;GPU = 3;SrcId = 160
    SrcName = CPU clock;SrcUnits = MHz;LocalizedSourceName = CPU clock;LocalizedSrcUnits = MHz;RecommendedFormat = %.0f;Data = 4490.521;MinLimit = 0;MaxLimit = 5000;Flags = None;GPU = 4294967295;SrcId = 160
    SrcName = CPU power;SrcUnits = W;LocalizedSourceName = CPU power;LocalizedSrcUnits = W;RecommendedFormat = %.1f;Data = 10.84375;MinLimit = 0;MaxLimit = 200;Flags = None;GPU = 4294967295;SrcId = 256
    SrcName = RAM usage;SrcUnits = MB;LocalizedSourceName = RAM usage;LocalizedSrcUnits = MB;RecommendedFormat = %.0f;Data = 11413;MinLimit = 0;MaxLimit = 16384;Flags = None;GPU = 0;SrcId = 145
    SrcName = Pagefile usage;SrcUnits = MB;LocalizedSourceName = Pagefile usage;LocalizedSrcUnits = MB;RecommendedFormat = %.0f;Data = 18021;MinLimit = 0;MaxLimit = 16384;Flags = None;GPU = 0;SrcId = 146
    GpuId = VEN_1002&DEV_67DF&SUBSYS_E347174B&REV_E7&BUS_1&DEV_0&FN_0;Family = Ellesmere;Device = Radeon RX 580 Series;Driver = Adrenalin 18.3.4;BIOS = 015.050.000.000;MemAmount = 0
    GpuId = VEN_8086&DEV_5912&SUBSYS_59121849&REV_04&BUS_0&DEV_2&FN_0;Family = ;Device = Intel(R) HD Graphics 630;Driver = ;BIOS = ;MemAmount = 0
    v1.1.0 didn't have this issue
     
  14. lemiteh

    lemiteh Guest

    Messages:
    2
    Likes Received:
    0
    GPU:
    1660 Super 6G
    Is this library still being maintained? If not, is the source code maybe available somewhere?
     
  15. Andy2021

    Andy2021 Guest

    Messages:
    3
    Likes Received:
    0
    GPU:
    RTX3070
    Hi All,
    This is a great bit of code and i have been using it to read the status of my RTX3070.
    I've spent ages trying to macm.CommitChanges() but I keep on getting an error

    Exception thrown: 'System.AccessViolationException' in MSIAfterburner.NET.dll
    An unhandled exception of type 'System.AccessViolationException' occurred in MSIAfterburner.NET.dll
    Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

    I'm currently using Afterburner v4.6.3
    I have stripped the example code back now to just be read the macm.GpuEntries and just spit them back to the GPU but no matter what I try i keep getting the same error.

    Does anyone have any suggestions?

    Many Thanks

    Andy
     

  16. Astyanax

    Astyanax Ancient Guru

    Messages:
    17,040
    Likes Received:
    7,379
    GPU:
    GTX 1080ti
    another application has loaded an older version of the system assemblies in global memory, the msi .net dll is a victim of it.
     
    Andy2021 likes this.
  17. Andy2021

    Andy2021 Guest

    Messages:
    3
    Likes Received:
    0
    GPU:
    RTX3070
    Hi I really appreciate your help. Could you explain what i need to do to fix it?
    I have now split to code down to commit changes to each GPU in turn to locate the problem.
    I can macm.CommitChanges() to GPU 0 and GPU 1 without issue, but it fails on GPU 2 and GPU 3. eg macm.CommitChanges(2), macm.CommitChanges(3).

    Exception thrown: 'System.AccessViolationException' in MSIAfterburner.NET.dll
    An unhandled exception of type 'System.AccessViolationException' occurred in MSIAfterburner.NET.dll
    Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

    I have tried targeting the VB frame work to 3.5 and this give me the error instead of crashing and i have built the App for x86.

    I'm using Afterburner v4.6.3, do i need an older version or something else?

    Any other suggestions?

    Many Thanks

    Andy
     
  18. Astyanax

    Astyanax Ancient Guru

    Messages:
    17,040
    Likes Received:
    7,379
    GPU:
    GTX 1080ti
    Ok, so whats happening (though i don't know .net enough to give you a fix) is that the first GPU is loading the namespace into global instead of shared memory and you can only load a single instance of a global namespace at a time.

    Refer to https://stackoverflow.com/questions/41552921/global-memory-access and you might see a fix yourself.
     
    Andy2021 likes this.
  19. Andy2021

    Andy2021 Guest

    Messages:
    3
    Likes Received:
    0
    GPU:
    RTX3070
    Thank you for your feedback.
    I've spent several hours looking into the shared memory and not global but to no avail. It looks like i need to load the GPU into to a memory file and then read it in and out of there. I can't see where the GPU info gets loaded to redirect it.

    All I need my program to do is to change the figures below for a number of GPUs, currently 4 off.

    macm.GpuEntries(0).PowerLimitCur = 52
    macm.GpuEntries(0).CoreClockBoostCur = -50000
    macm.GpuEntries(0).MemoryClockBoostCur = 200000
    macm.GpuEntries(0).ThermalLimitCur = 65
    macm.CommitChanges(0)

    macm.GpuEntries(1).PowerLimitCur = 42
    macm.GpuEntries(1).CoreClockBoostCur = -100000
    macm.GpuEntries(1).MemoryClockBoostCur = 100000
    macm.GpuEntries(1).ThermalLimitCur = 65
    macm.CommitChanges(1)
    etc....
    Is there anyway I can do this simply?
    From the mahm (Hardware Monitor) i have the GPU IDs, can i just sent the details direct?

    if there is a workaround in another language then I can convert over the that if its easier, or convert from another language back to VB.net.

    Thanks

    Andy
     
  20. hen@brosh

    hen@brosh Guest

    Messages:
    1
    Likes Received:
    0
    GPU:
    6gb
    ThanksHello, I have a problem installing version 4. After installation, MSIAfterburner.NET.dll appears in the installation folder. What should I do? How do I connect to the msi afterburner .net class. In version 4
    Thanks
     

Share This Page