dotnet / machinelearning

ML.NET is an open source and cross-platform machine learning framework for .NET.
https://dot.net/ml
MIT License
8.99k stars 1.88k forks source link

Segmentation Fault #6737

Open ghost opened 1 year ago

ghost commented 1 year ago

System Information (please complete the following information):

Describe the bug The C# application crashes giving a segmentation fault (core dumped) error. The kernel logs show this thing, "motadata992 kernel: [2321935.184101] aiopsengine[1265920]: segfault at 10 ip 00007f00fb38143d sp 00007f014f4fc0a8 error 4 in libMklImports.so[7f00fa469000+5888000]".

To Reproduce No reproduce steps.

Expected behavior The C# application should run without crashing.

Screenshots, Code, Sample Projects

Additional context Below is the Anomaly Detector Code which uses SR-CNN approach provided by ML-Net to detect anomalies.

`using System.Text; using Microsoft.ML; using Microsoft.ML.TimeSeries;

namespace ML.Tasks;

public class AnomalyDetector { private readonly MLContext _mlContext;

public AnomalyDetector(MLContext mlContext)
{
    _mlContext = mlContext;
}

public List<Prediction>? Predict(IDataView dataView, StringBuilder errors)
{
    try
    {
        var period = Util.CalculatePeriodicity(_mlContext, dataView, nameof(Input.Value));

        var configOptions = new SrCnnEntireAnomalyDetectorOptions
        {
            DetectMode = SrCnnDetectMode.AnomalyAndMargin,
        };

        if (period != Constants.NotAvailable)
        {
            configOptions.Period = period;
        }

        return _mlContext.Data.CreateEnumerable<Prediction>(
            _mlContext.AnomalyDetection.DetectEntireAnomalyBySrCnn(dataView, nameof(Prediction.Output),
                nameof(Input.Value),
                options: configOptions), false).ToList();
    }
    catch (Exception e)
    {
        Bootstrap.Logger.Error(e);

        errors.Append($"error {e.Message} occurred while detecting anomalies, stack: {e.StackTrace}");
    }

    return null;
}

public class Prediction
{
    public double[] Output { get; set; } = null!;
}

public class Input
{
    public double Value { get; set; }
}

}`

ghost commented 1 year ago

@codemzs @sfilipi Can you please help me asap regarding this issue

luisquintanilla commented 1 year ago

Hi @sheldor173

Are you running Ubuntu? Just want to confirm since it's not part of the OS. Can you provide repro code that you used to train as well as a sample of your data so we can better help you.

ghost commented 1 year ago

This issue has been marked needs-author-action and may be missing some important information.

ghost commented 1 year ago

hie @luisquintanilla, yes, I am using Ubuntu 20. Unfortunately, I don't have the repro steps but I can show you that the error occurs in intel-mkl library, and as per my use-cases this library is being used while calculating ForwardFft() to calculate period for detecting anomaly by SRCNN.